Incorporating a ternary matrix into a neural network

ABSTRACT

Artificial neural networks (ANNs) are computing systems inspired by the human brain by learning to perform tasks by considering examples. These ANNs are typically created by connecting several layers of artificial neurons using connections, where each artificial neuron is connected to every other artificial neuron either directly or indirectly to create fully connected layers within the ANN. By substituting ternary matrices for one or more fully connected layers within the ANN, a complexity and resource usage of the ANN may be reduced, while improving the performance of the ANN.

CLAIM OF PRIORITY

This application claims the benefit of U.S. Provisional Application No.63/106,287 (Attorney Docket No. NVIDP1323+/20-BR-0460US01) titled“CONVOLUTIONS BY RANDOM TERNARY MATRICES,” filed Oct. 27, 2020, theentire contents of which is incorporated herein by reference.

FIELD OF THE INVENTION

The present invention relates to artificial neural networks, and moreparticularly to incorporating one or more ternary matrices into a neuralnetwork.

BACKGROUND

Artificial neural networks (ANNs) are commonly used computing systemsthat address a wide variety of tasks, such as classification, imagerecognition, regression, function approximation, samples of dataaccording to a learned distribution, etc. However, ANN implementationsoften include fully connected layers (1×1 convolutions) that arecomputationally expensive and time-consuming to implement, train, andoperate. There is a need for ANNs that are simpler, faster, and lessresource-intensive to implement, train and operate.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates a flowchart of a method for incorporating a ternarymatrix into a neural network, in accordance with an embodiment.

FIG. 2 illustrates a parallel processing unit, in accordance with anembodiment.

FIG. 3A illustrates a general processing cluster within the parallelprocessing unit of FIG. 2, in accordance with an embodiment.

FIG. 3B illustrates a memory partition unit of the parallel processingunit of FIG. 2, in accordance with an embodiment.

FIG. 4A illustrates the streaming multi-processor of FIG. 3A, inaccordance with an embodiment.

FIG. 4B is a conceptual diagram of a processing system implemented usingthe PPU of FIG. 2, in accordance with an embodiment.

FIG. 4C illustrates an exemplary system in which the variousarchitecture and/or functionality of the various previous embodimentsmay be implemented.

FIG. 5 is a conceptual diagram of a graphics processing pipelineimplemented by the PPU of FIG. 2, in accordance with an embodiment.

FIG. 6 illustrates an exemplary directed graph of an artificial neuralnetwork, in accordance with an embodiment.

FIG. 7 illustrates an exemplary interpretation of projections ontohalfspaces as ReLU neural units, in accordance with an embodiment.

FIG. 8 illustrates an exemplary comparison of two instances of dropoutto an instance of partition, in accordance with an embodiment.

FIG. 9 illustrates exemplary selected paths in an artificial neuralnetwork, in accordance with an embodiment.

FIG. 10 illustrates subsampling activations of an entire feature layeronline during inference (and training), in accordance with anembodiment.

FIG. 11 illustrates a flowchart of a method for generating paths toconnect a set of neural units within an artificial neural network, inaccordance with an embodiment.

FIG. 12 illustrates a flowchart of a method for compressing anartificial neural network, in accordance with an embodiment.

FIG. 13 illustrates a flowchart of a method for performing networknormalization, in accordance with an embodiment.

DETAILED DESCRIPTION

Artificial neural networks (ANNs) are computing systems that motivatedby the human brain learn to perform tasks by considering examples. TheseANNs are typically created by connecting several layers of artificialneurons using connections, where each artificial neuron may be connectedto every other artificial neuron either directly or indirectly to createfully connected layers within the ANN. By substituting ternary matricesfor one or more weight matrices of fully connected layers within theANN, a complexity and resource usage of the ANN may be reduced, whileimproving the performance of the ANN.

FIG. 1 illustrates a flowchart of a method 100 for incorporating aternary matrix into a neural network, in accordance with an embodiment.Although method 100 is described in the context of a processing unit,the method 100 may also be performed by a program, custom circuitry, orby a combination of custom circuitry and a program. For example, themethod 100 may be executed by a GPU (graphics processing unit), CPU(central processing unit), an FPGA (field programmable gate array), orany processor capable of performing ANN computations. Furthermore,persons of ordinary skill in the art will understand that any systemthat performs method 100 is within the scope and spirit of embodimentsof the present invention.

As shown in operation 102, an artificial neural network (ANN) includinga plurality of layers is created, where the plurality of layers includesat least one ternary matrix. In one embodiment, the ANN may include aplurality of paths each connecting at least one input of the ANN to atleast one output of the ANN. In another embodiment, each of theplurality of paths may include a plurality of vertices each representinga neural unit within the ANN, and a plurality of edges each representinga weighted connection within the ANN.

Additionally, in one embodiment, the ANN may include a convolutionalmodel. For example, the ANN may transcribe speech, recognize speechcommands, recognize speakers, etc. In another embodiment, the ANN mayperform classification, image recognition, etc.

In one embodiment, each ternary matrix may include a matrix thatincludes only the values −1, 0, and 1. Further, in one embodiment eachternary matrix within the ANN may replace a fully connected layer withinthe ANN (e.g., a 1×1 convolution within the ANN, etc.).

In another embodiment, each ternary matrix may be used instead of a 1×1convolution. In yet another embodiment, each ternary matrix may be usedinstead of a 1×1 convolution in at least one residual layer of the ANNusing at least one of a depth-wise separable convolution. In oneembodiment, the depth-wise separable convolution is a time-channelseparable convolution. In one example, output from a firstfully-connected neural network layer may be provided as input to theternary matrix, and output from the ternary matrix may be provided asinput to a second fully-connected neural network layer.

In another embodiment, each of the at least one ternary matrix may berandomly generated. For example, each of the ternary matrices mayinclude a fixed sparse ternary random matrix. Further still, in oneembodiment, the elements of at least one ternary matrix may be generatedon-chip (e.g., utilizing one or more hardware processors that implementthe ANN, etc.). In another embodiment, each ternary matrix may begenerated by using a pseudo-random number generator. For example, theone or more hardware processors may initialize each of the ternarymatrices at random. In another example, each of the values within theinitialized matrices may be quantized utilizing a threshold value t toobtain ternary matrix values.

For instance, all weights in the matrix may be quantized. In oneembodiment, if a weight in the matrix is smaller than −t, then theweight is assigned a value of −1. In another embodiment, if a weight inthe matrix is between −t and t, then the weight is assigned a value of0. In yet another embodiment, if a weight in the matrix is greater thant, then the weight is assigned a value of 1. In another example, anabsolute value of each of the values within the initialized matrices maybe determined to obtain ternary matrix values.

Also, in one embodiment, a hardware-based pseudo-random number generatormay be used to generate the weights. In another embodiment, thethreshold value t may be increased to increase the sparsity of theresulting ternary matrix. In yet another embodiment, the ternary matrixvalues may then be fixed within the ANN so that they do not changeduring the training of the ANN, during the performance of inferenceutilizing the ANN, etc.

In addition, in one embodiment, for each ternary matrix, an initialstate (e.g. one or more seed values, etc.) of the hardware-basedpseudo-random number generator that was used to generate the weights forthe quantization of the ternary matrix may be stored. This stored statemay be used to regenerate/recreate the associated ternary matrix (e.g.,in order to recreate an identical ANN at a later time, etc.).

Furthermore, in one embodiment, each ternary matrix may generated bypaths generated utilizing a low discrepancy sequence. In anotherembodiment, the plurality of layers may also include one or moreidentity matrices. For example, at least one skip link of the at leastone residual layer of the ANN may be replaced by an identity matrix(e.g., a unit matrix, etc.). In another example, each identity matrixwithin the ANN may replace a fully connected layer within the ANN (e.g.,a 1×1 convolution within the ANN, etc.). In another example, eachidentity matrix may copy the input directly to the output of the matrix(thereby eliminating the need for quadratic matrix multiplication duringtraining/inference).

Further still, as shown in operation 104, the ANN is trained andinference is performed utilizing the trained ANN, where the at least oneternary matrix remains constant during the training and inference. Forexample, the values of each ternary matrix may remain constant and maynot change during the training of the ANN. In one embodiment, the ANNmay be trained utilizing labeled input training data. In anotherembodiment, the training may be supervised, semi-supervised,unsupervised, etc.

Also, in one embodiment, the values of each ternary matrix may remainconstant and may not change during both the training and the performanceof inference utilizing the ANN. In another embodiment, the ANN may beused to perform inference by applying the trained ANN to an input dataset to infer a result. For example, a data set may be input into thetrained ANN, and the trained ANN may output one or more predictionsbased on the input.

Additionally, in one embodiment, input data may be processed by the ANNto produce output data. For example, the input data may include one ormore of image data, textual data, audio data, video data, randomnumbers, pseudo-random numbers, quasi-random numbers, low discrepancysequences, etc. In another embodiment, the output data may include oneor more of a classification, a categorization, a probability, aregression, function approximation, samples of data according to alearned distribution (e.g. generative adversarial networks (GANs)), etc.

Further, in one embodiment, the input data may include environmentaldata (e.g., recorded image data of an environment surrounding anautomobile, etc.), and the output data may include anidentification/classification of one or more objects within theenvironmental data (such as cars, cyclists, pedestrians, etc.). Inanother embodiment, the ternary matrix may remain constant in that thevalues of the ternary matrix may not change (e.g., during the trainingof the ANN, during the performance of inference utilizing the ANN,etc.).

Further still, in one embodiment, during the training of the ANN, andduring the performance of inference utilizing the ANN, multiplicationactions performed utilizing each of the at least one ternary matrix maybe executed as a difference of two sums, where the first sum is the sumof all inputs to be weighted by the value 1 and the second sum is thesum of all inputs to be weighted by the value −1.

Also, in one embodiment, the ANN may be implemented as a hardwarecircuit. For example, during the performance of inference utilizing theANN, multiplication actions performed utilizing each of the at least oneternary matrix may be executed as a difference of two sums. In anotherexample, the difference may be amplified by an operational amplifier. Inyet another example, each sum may be computed by wiring the selectedinput on either the positive or negative input line of the operationalamplifier.

In this way, a creation of the ANN may be simplified utilizing ternaryand identity matrices, which are significantly less computationallyexpensive to create and execute when compared to fully connectedlayers/1×1 convolutions. This may reduce an amount of hardware resourceusage needed to create/train/execute the ANN. Additionally, sinceternary matrices may be created on-chip, only a seed value for thepseudo-random number generator may need to be stored to create suchmatrices, which may reduce an amount of hardware storage space needed tocreate the resulting ANN. Further, during an implementation of an ANN,each ternary matrix may be executed by calculating a difference of twosums, instead of calculating more costly matrix multiplications oftraditional fully-connected layers. This may improve a performance ofANNs utilizing ternary matrices.

Further still, by increasing the threshold value t during quantization,the resulting ternary matrices may become more sparse, which may furtherimprove the performance of ternary matrix execution (e.g., since morenon-zero values exist in the resulting ternary matrix, and differencecalculations need only be performed for non-zero values in the matrix).

In yet another embodiment, the ANN may be created, trained, and/orimplemented utilizing the parallel processing unit (PPU) 200 of FIG. 2.

Additionally, since the number of nonzero weights may be selected in anembodiment, the computational complexity of a neural network layer maybe reduced from quadratic to linear complexity. Neural networks may berepresented by paths. In one embodiment, such path may be generated bysampling. Further, sampling may be performed proportional to discretedensities/weights within the ANN. Further still, sampling may beperformed proportional to activations within the ANN. Also, weights of aneural network may be normalized, and the normalized weights may bepropagated. In addition, network partitioning may be performed, andweights may be sub-sampled from a fully connected/convolutional neuralnetwork.

More illustrative information will now be set forth regarding variousoptional architectures and features with which the foregoing frameworkmay be implemented, per the desires of the user. It should be stronglynoted that the following information is set forth for illustrativepurposes and should not be construed as limiting in any manner. Any ofthe following features may be optionally incorporated with or withoutthe exclusion of other features described. In one embodiment, the samerandom ternary matrices may be used throughout the network.

Parallel Processing Architecture

FIG. 2 illustrates a parallel processing unit (PPU) 200, in accordancewith an embodiment. In an embodiment, the PPU 200 is a multi-threadedprocessor that is implemented on one or more integrated circuit devices.The PPU 200 is a latency hiding architecture designed to process manythreads in parallel. A thread (i.e., a thread of execution) is aninstantiation of a set of instructions configured to be executed by thePPU 200. In an embodiment, the PPU 200 is a graphics processing unit(GPU) configured to implement a graphics rendering pipeline forprocessing three-dimensional (3D) graphics data in order to generatetwo-dimensional (2D) image data for display on a display device such asa liquid crystal display (LCD) device. In other embodiments, the PPU 200may be utilized for performing general-purpose computations. While oneexemplary parallel processor is provided herein for illustrativepurposes, it should be strongly noted that such processor is set forthfor illustrative purposes only, and that any processor may be employedto supplement and/or substitute for the same.

One or more PPUs 200 may be configured to accelerate thousands of HighPerformance Computing (HPC), data center, and machine learningapplications. The PPU 200 may be configured to accelerate numerous deeplearning systems and applications including autonomous vehicleplatforms, deep learning, high-accuracy speech, image, and textrecognition systems, intelligent video analytics, molecular simulations,drug discovery, disease diagnosis, weather forecasting, big dataanalytics, astronomy, molecular dynamics simulation, financial modeling,robotics, factory automation, real-time language translation, onlinesearch optimizations, and personalized user recommendations, and thelike.

As shown in FIG. 2, the PPU 200 includes an Input/Output (I/O) unit 205,a front end unit 215, a scheduler unit 220, a work distribution unit225, a hub 230, a crossbar (Xbar) 270, one or more general processingclusters (GPCs) 250, and one or more partition units 280. The PPU 200may be connected to a host processor or other PPUs 200 via one or morehigh-speed NVLink 210 interconnect. The PPU 200 may be connected to ahost processor or other peripheral devices via an interconnect 202. ThePPU 200 may also be connected to a local memory comprising a number ofmemory devices 204. In an embodiment, the local memory may comprise anumber of dynamic random access memory (DRAM) devices. The DRAM devicesmay be configured as a high-bandwidth memory (HBM) subsystem, withmultiple DRAM dies stacked within each device.

The NVLink 210 interconnect enables systems to scale and include one ormore PPUs 200 combined with one or more CPUs, supports cache coherencebetween the PPUs 200 and CPUs, and CPU mastering. Data and/or commandsmay be transmitted by the NVLink 210 through the hub 230 to/from otherunits of the PPU 200 such as one or more copy engines, a video encoder,a video decoder, a power management unit, etc. (not explicitly shown).The NVLink 210 is described in more detail in conjunction with FIG. 4B.

The I/O unit 205 is configured to transmit and receive communications(i.e., commands, data, etc.) from a host processor (not shown) over theinterconnect 202. The I/O unit 205 may communicate with the hostprocessor directly via the interconnect 202 or through one or moreintermediate devices such as a memory bridge. In an embodiment, the I/Ounit 205 may communicate with one or more other processors, such as oneor more the PPUs 200 via the interconnect 202. In an embodiment, the I/Ounit 205 implements a Peripheral Component Interconnect Express (PCIe)interface for communications over a PCIe bus and the interconnect 202 isa PCIe bus. In alternative embodiments, the I/O unit 205 may implementother types of well-known interfaces for communicating with externaldevices.

The I/O unit 205 decodes packets received via the interconnect 202. Inan embodiment, the packets represent commands configured to cause thePPU 200 to perform various operations. The I/O unit 205 transmits thedecoded commands to various other units of the PPU 200 as the commandsmay specify. For example, some commands may be transmitted to the frontend unit 215. Other commands may be transmitted to the hub 230 or otherunits of the PPU 200 such as one or more copy engines, a video encoder,a video decoder, a power management unit, etc. (not explicitly shown).In other words, the I/O unit 205 is configured to route communicationsbetween and among the various logical units of the PPU 200.

In an embodiment, a program executed by the host processor encodes acommand stream in a buffer that provides workloads to the PPU 200 forprocessing. A workload may comprise several instructions and data to beprocessed by those instructions. The buffer is a region in a memory thatis accessible (i.e., read/write) by both the host processor and the PPU200. For example, the I/O unit 205 may be configured to access thebuffer in a system memory connected to the interconnect 202 via memoryrequests transmitted over the interconnect 202. In an embodiment, thehost processor writes the command stream to the buffer and thentransmits a pointer to the start of the command stream to the PPU 200.The front end unit 215 receives pointers to one or more command streams.The front end unit 215 manages the one or more streams, reading commandsfrom the streams and forwarding commands to the various units of the PPU200.

The front end unit 215 is coupled to a scheduler unit 220 thatconfigures the various GPCs 250 to process tasks defined by the one ormore streams. The scheduler unit 220 is configured to track stateinformation related to the various tasks managed by the scheduler unit220. The state may indicate which GPC 250 a task is assigned to, whetherthe task is active or inactive, a priority level associated with thetask, and so forth. The scheduler unit 220 manages the execution of aplurality of tasks on the one or more GPCs 250.

The scheduler unit 220 is coupled to a work distribution unit 225 thatis configured to dispatch tasks for execution on the GPCs 250. The workdistribution unit 225 may track a number of scheduled tasks receivedfrom the scheduler unit 220. In an embodiment, the work distributionunit 225 manages a pending task pool and an active task pool for each ofthe GPCs 250. The pending task pool may comprise a number of slots(e.g., 32 slots) that contain tasks assigned to be processed by aparticular GPC 250. The active task pool may comprise a number of slots(e.g., 4 slots) for tasks that are actively being processed by the GPCs250. As a GPC 250 finishes the execution of a task, that task is evictedfrom the active task pool for the GPC 250 and one of the other tasksfrom the pending task pool is selected and scheduled for execution onthe GPC 250. If an active task has been idle on the GPC 250, such aswhile waiting for a data dependency to be resolved, then the active taskmay be evicted from the GPC 250 and returned to the pending task poolwhile another task in the pending task pool is selected and scheduledfor execution on the GPC 250.

The work distribution unit 225 communicates with the one or more GPCs250 via XBar 270. The XBar 270 is an interconnect network that couplesmany of the units of the PPU 200 to other units of the PPU 200. Forexample, the XBar 270 may be configured to couple the work distributionunit 225 to a particular GPC 250. Although not shown explicitly, one ormore other units of the PPU 200 may also be connected to the XBar 270via the hub 230.

The tasks are managed by the scheduler unit 220 and dispatched to a GPC250 by the work distribution unit 225. The GPC 250 is configured toprocess the task and generate results. The results may be consumed byother tasks within the GPC 250, routed to a different GPC 250 via theXBar 270, or stored in the memory 204. The results can be written to thememory 204 via the partition units 280, which implement a memoryinterface for reading and writing data to/from the memory 204. Theresults can be transmitted to another PPU 200 or CPU via the NVLink 210.In an embodiment, the PPU 200 includes a number U of partition units 280that is equal to the number of separate and distinct memory devices 204coupled to the PPU 200. A partition unit 280 will be described in moredetail below in conjunction with FIG. 3B.

In an embodiment, a host processor executes a driver kernel thatimplements an application programming interface (API) that enables oneor more applications executing on the host processor to scheduleoperations for execution on the PPU 200. In an embodiment, multiplecompute applications are simultaneously executed by the PPU 200 and thePPU 200 provides isolation, quality of service (QoS), and independentaddress spaces for the multiple compute applications. An application maygenerate instructions (i.e., API calls) that cause the driver kernel togenerate one or more tasks for execution by the PPU 200. The driverkernel outputs tasks to one or more streams being processed by the PPU200. Each task may comprise one or more groups of related threads,referred to herein as a warp. In an embodiment, a warp comprises 32related threads that may be executed in parallel. Cooperating threadsmay refer to a plurality of threads including instructions to performthe task and that may exchange data through shared memory. Threads andcooperating threads are described in more detail in conjunction withFIG. 4A.

FIG. 3A illustrates a GPC 250 of the PPU 200 of FIG. 2, in accordancewith an embodiment. As shown in FIG. 3A, each GPC 250 includes a numberof hardware units for processing tasks. In an embodiment, each GPC 250includes a pipeline manager 310, a pre-raster operations unit (PROP)315, a raster engine 325, a work distribution crossbar (WDX) 380, amemory management unit (MMU) 390, and one or more Data ProcessingClusters (DPCs) 320. It will be appreciated that the GPC 250 of FIG. 3Amay include other hardware units in lieu of or in addition to the unitsshown in FIG. 3A.

In an embodiment, the operation of the GPC 250 is controlled by thepipeline manager 310. The pipeline manager 310 manages the configurationof the one or more DPCs 320 for processing tasks allocated to the GPC250. In an embodiment, the pipeline manager 310 may configure at leastone of the one or more DPCs 320 to implement at least a portion of agraphics rendering pipeline. For example, a DPC 320 may be configured toexecute a vertex shader program on the programmable streamingmultiprocessor (SM) 340. The pipeline manager 310 may also be configuredto route packets received from the work distribution unit 225 to theappropriate logical units within the GPC 250. For example, some packetsmay be routed to fixed function hardware units in the PROP 315 and/orraster engine 325 while other packets may be routed to the DPCs 320 forprocessing by the primitive engine 335 or the SM 340. In an embodiment,the pipeline manager 310 may configure at least one of the one or moreDPCs 320 to implement a neural network model and/or a computingpipeline.

The PROP unit 315 is configured to route data generated by the rasterengine 325 and the DPCs 320 to a Raster Operations (ROP) unit, describedin more detail in conjunction with FIG. 3B. The PROP unit 315 may alsobe configured to perform optimizations for color blending, organizepixel data, perform address translations, and the like.

The raster engine 325 includes a number of fixed function hardware unitsconfigured to perform various raster operations. In an embodiment, theraster engine 325 includes a setup engine, a coarse raster engine, aculling engine, a clipping engine, a fine raster engine, and a tilecoalescing engine. The setup engine receives transformed vertices andgenerates plane equations associated with the geometric primitivedefined by the vertices. The plane equations are transmitted to thecoarse raster engine to generate coverage information (e.g., an x,ycoverage mask for a tile) for the primitive. The output of the coarseraster engine is transmitted to the culling engine where fragmentsassociated with the primitive that fail a z-test are culled, andtransmitted to a clipping engine where fragments lying outside a viewingfrustum are clipped. Those fragments that survive clipping and cullingmay be passed to the fine raster engine to generate attributes for thepixel fragments based on the plane equations generated by the setupengine. The output of the raster engine 325 comprises fragments to beprocessed, for example, by a fragment shader implemented within a DPC320.

Each DPC 320 included in the GPC 250 includes an M-Pipe Controller (MPC)330, a primitive engine 335, and one or more SMs 340. The MPC 330controls the operation of the DPC 320, routing packets received from thepipeline manager 310 to the appropriate units in the DPC 320. Forexample, packets associated with a vertex may be routed to the primitiveengine 335, which is configured to fetch vertex attributes associatedwith the vertex from the memory 204. In contrast, packets associatedwith a shader program may be transmitted to the SM 340.

The SM 340 comprises a programmable streaming processor that isconfigured to process tasks represented by a number of threads. Each SM340 is multi-threaded and configured to execute a plurality of threads(e.g., 32 threads) from a particular group of threads concurrently. Inan embodiment, the SM 340 implements a SIMD (Single-Instruction,Multiple-Data) architecture where each thread in a group of threads(i.e., a warp) is configured to process a different set of data based onthe same set of instructions. All threads in the group of threadsexecute the same instructions. In another embodiment, the SM 340implements a SIMT (Single-Instruction, Multiple Thread) architecturewhere each thread in a group of threads is configured to process adifferent set of data based on the same set of instructions, but whereindividual threads in the group of threads are allowed to diverge duringexecution. In an embodiment, a program counter, call stack, andexecution state is maintained for each warp, enabling concurrencybetween warps and serial execution within warps when threads within thewarp diverge. In another embodiment, a program counter, call stack, andexecution state is maintained for each individual thread, enabling equalconcurrency between all threads, within and between warps. Whenexecution state is maintained for each individual thread, threadsexecuting the same instructions may be converged and executed inparallel for maximum efficiency. The SM 340 will be described in moredetail below in conjunction with FIG. 4A.

The MMU 390 provides an interface between the GPC 250 and the partitionunit 280. The MMU 390 may provide translation of virtual addresses intophysical addresses, memory protection, and arbitration of memoryrequests. In an embodiment, the MMU 390 provides one or more translationlookaside buffers (TLBs) for performing translation of virtual addressesinto physical addresses in the memory 204.

FIG. 3B illustrates a memory partition unit 280 of the PPU 200 of FIG.2, in accordance with an embodiment. As shown in FIG. 3B, the memorypartition unit 280 includes a Raster Operations (ROP) unit 350, a leveltwo (L2) cache 360, and a memory interface 370. The memory interface 370is coupled to the memory 204. Memory interface 370 may implement 32, 64,128, 1024-bit data buses, or the like, for high-speed data transfer. Inan embodiment, the PPU 200 incorporates U memory interfaces 370, onememory interface 370 per pair of partition units 280, where each pair ofpartition units 280 is connected to a corresponding memory device 204.For example, PPU 200 may be connected to up to Y memory devices 204,such as high bandwidth memory stacks or graphics double-data-rate,version 5, synchronous dynamic random access memory, or other types ofpersistent storage.

In an embodiment, the memory interface 370 implements an HBM2 memoryinterface and Y equals half U. In an embodiment, the HBM2 memory stacksare located on the same physical package as the PPU 200, providingsubstantial power and area savings compared with conventional GDDR5SDRAM systems. In an embodiment, each HBM2 stack includes four memorydies and Y equals 4, with HBM2 stack including two 128-bit channels perdie for a total of 8 channels and a data bus width of 1024 bits.

In an embodiment, the memory 204 supports Single-Error CorrectingDouble-Error Detecting (SECDED) Error Correction Code (ECC) to protectdata. ECC provides higher reliability for compute applications that aresensitive to data corruption. Reliability is especially important inlarge-scale cluster computing environments where PPUs 200 process verylarge datasets and/or run applications for extended periods.

In an embodiment, the PPU 200 implements a multi-level memory hierarchy.In an embodiment, the memory partition unit 280 supports a unifiedmemory to provide a single unified virtual address space for CPU and PPU200 memory, enabling data sharing between virtual memory systems. In anembodiment the frequency of accesses by a PPU 200 to memory located onother processors is traced to ensure that memory pages are moved to thephysical memory of the PPU 200 that is accessing the pages morefrequently. In an embodiment, the NVLink 210 supports addresstranslation services allowing the PPU 200 to directly access a CPU'spage tables and providing full access to CPU memory by the PPU 200.

In an embodiment, copy engines transfer data between multiple PPUs 200or between PPUs 200 and CPUs. The copy engines can generate page faultsfor addresses that are not mapped into the page tables. The memorypartition unit 280 can then service the page faults, mapping theaddresses into the page table, after which the copy engine can performthe transfer. In a conventional system, memory is pinned (i.e.,non-pageable) for multiple copy engine operations between multipleprocessors, substantially reducing the available memory. With hardwarepage faulting, addresses can be passed to the copy engines withoutworrying if the memory pages are resident, and the copy process istransparent.

Data from the memory 204 or other system memory may be fetched by thememory partition unit 280 and stored in the L2 cache 360, which islocated on-chip and is shared between the various GPCs 250. As shown,each memory partition unit 280 includes a portion of the L2 cache 360associated with a corresponding memory device 204. Lower level cachesmay then be implemented in various units within the GPCs 250. Forexample, each of the SMs 340 may implement a level one (L1) cache. TheL1 cache is private memory that is dedicated to a particular SM 340.Data from the L2 cache 360 may be fetched and stored in each of the L1caches for processing in the functional units of the SMs 340. The L2cache 360 is coupled to the memory interface 370 and the XBar 270.

The ROP unit 350 performs graphics raster operations related to pixelcolor, such as color compression, pixel blending, and the like. The ROPunit 350 also implements depth testing in conjunction with the rasterengine 325, receiving a depth for a sample location associated with apixel fragment from the culling engine of the raster engine 325. Thedepth is tested against a corresponding depth in a depth buffer for asample location associated with the fragment. If the fragment passes thedepth test for the sample location, then the ROP unit 350 updates thedepth buffer and transmits a result of the depth test to the rasterengine 325. It will be appreciated that the number of partition units280 may be different than the number of GPCs 250 and, therefore, eachROP unit 350 may be coupled to each of the GPCs 250. The ROP unit 350tracks packets received from the different GPCs 250 and determines whichGPC 250 that a result generated by the ROP unit 350 is routed to throughthe Xbar 270. Although the ROP unit 350 is included within the memorypartition unit 280 in FIG. 3B, in other embodiment, the ROP unit 350 maybe outside of the memory partition unit 280. For example, the ROP unit350 may reside in the GPC 250 or another unit.

FIG. 4A illustrates the streaming multi-processor 340 of FIG. 3A, inaccordance with an embodiment. As shown in FIG. 4A, the SM 340 includesan instruction cache 405, one or more scheduler units 410(K), a registerfile 420, one or more processing cores 450, one or more special functionunits (SFUs) 452, one or more load/store units (LSUs) 454, aninterconnect network 480, a shared memory/L1 cache 470.

As described above, the work distribution unit 225 dispatches tasks forexecution on the GPCs 250 of the PPU 200. The tasks are allocated to aparticular DPC 320 within a GPC 250 and, if the task is associated witha shader program, the task may be allocated to an SM 340. The schedulerunit 410(K) receives the tasks from the work distribution unit 225 andmanages instruction scheduling for one or more thread blocks assigned tothe SM 340. The scheduler unit 410(K) schedules thread blocks forexecution as warps of parallel threads, where each thread block isallocated at least one warp. In an embodiment, each warp executes 32threads. The scheduler unit 410(K) may manage a plurality of differentthread blocks, allocating the warps to the different thread blocks andthen dispatching instructions from the plurality of differentcooperative groups to the various functional units (i.e., cores 450,SFUs 452, and LSUs 454) during each clock cycle.

Cooperative Groups is a programming model for organizing groups ofcommunicating threads that allows developers to express the granularityat which threads are communicating, enabling the expression of richer,more efficient parallel decompositions. Cooperative launch APIs supportsynchronization amongst thread blocks for the execution of parallelalgorithms. Conventional programming models provide a single, simpleconstruct for synchronizing cooperating threads: a barrier across allthreads of a thread block (i.e., the syncthreads( ) function). However,programmers would often like to define groups of threads at smaller thanthread block granularities and synchronize within the defined groups toenable greater performance, design flexibility, and software reuse inthe form of collective group-wide function interfaces.

Cooperative Groups enables programmers to define groups of threadsexplicitly at sub-block (i.e., as small as a single thread) andmulti-block granularities, and to perform collective operations such assynchronization on the threads in a cooperative group. The programmingmodel supports clean composition across software boundaries, so thatlibraries and utility functions can synchronize safely within theirlocal context without having to make assumptions about convergence.Cooperative Groups primitives enable new patterns of cooperativeparallelism, including producer-consumer parallelism, opportunisticparallelism, and global synchronization across an entire grid of threadblocks.

A dispatch unit 415 is configured to transmit instructions to one ormore of the functional units. In the embodiment, the scheduler unit410(K) includes two dispatch units 415 that enable two differentinstructions from the same warp to be dispatched during each clockcycle. In alternative embodiments, each scheduler unit 410(K) mayinclude a single dispatch unit 415 or additional dispatch units 415.

Each SM 340 includes a register file 420 that provides a set ofregisters for the functional units of the SM 340. In an embodiment, theregister file 420 is divided between each of the functional units suchthat each functional unit is allocated a dedicated portion of theregister file 420. In another embodiment, the register file 420 isdivided between the different warps being executed by the SM 340. Theregister file 420 provides temporary storage for operands connected tothe data paths of the functional units.

Each SM 340 comprises L processing cores 450. In an embodiment, the SM340 includes a large number (e.g., 128, etc.) of distinct processingcores 450. Each core 450 may include a fully-pipelined,single-precision, double-precision, and/or mixed precision processingunit that includes a floating point arithmetic logic unit and an integerarithmetic logic unit. In an embodiment, the floating point arithmeticlogic units implement the IEEE 754-2008 standard for floating pointarithmetic. In an embodiment, the cores 450 include 64 single-precision(32-bit) floating point cores, 64 integer cores, 32 double-precision(64-bit) floating point cores, and 8 tensor cores.

Tensor cores configured to perform matrix operations, and, in anembodiment, one or more tensor cores are included in the cores 450. Inparticular, the tensor cores are configured to perform deep learningmatrix arithmetic, such as convolution operations for neural networktraining and inferencing. In an embodiment, each tensor core operates ona 4×4 matrix and performs a matrix multiply and accumulate operationD=A×B+C, where A, B, C, and D are 4×4 matrices.

In an embodiment, the matrix multiply inputs A and B are 16-bit floatingpoint matrices, while the accumulation matrices C and D may be 16-bitfloating point or 32-bit floating point matrices. Tensor Cores operateon 16-bit floating point input data with 32-bit floating pointaccumulation. The 16-bit floating point multiply requires 64 operationsand results in a full precision product that is then accumulated using32-bit floating point addition with the other intermediate products fora 4×4×4 matrix multiply. In practice, Tensor Cores are used to performmuch larger two-dimensional or higher dimensional matrix operations,built up from these smaller elements. An API, such as CUDA 9 C++ API,exposes specialized matrix load, matrix multiply and accumulate, andmatrix store operations to efficiently use Tensor Cores from a CUDA-C++program. At the CUDA level, the warp-level interface assumes 16×16 sizematrices spanning all 32 threads of the warp.

Each SM 340 also comprises M SFUs 452 that perform special functions(e.g., attribute evaluation, reciprocal square root, and the like). Inan embodiment, the SFUs 452 may include a tree traversal unit configuredto traverse a hierarchical tree data structure. In an embodiment, theSFUs 452 may include texture unit configured to perform texture mapfiltering operations. In an embodiment, the texture units are configuredto load texture maps (e.g., a 2D array of texels) from the memory 204and sample the texture maps to produce sampled texture values for use inshader programs executed by the SM 340. In an embodiment, the texturemaps are stored in the shared memory/L1 cache 370. The texture unitsimplement texture operations such as filtering operations using mip-maps(i.e., texture maps of varying levels of detail). In an embodiment, eachSM 240 includes two texture units.

Each SM 340 also comprises N LSUs 454 that implement load and storeoperations between the shared memory/L1 cache 470 and the register file420. Each SM 340 includes an interconnect network 480 that connects eachof the functional units to the register file 420 and the LSU 454 to theregister file 420, shared memory/L1 cache 470. In an embodiment, theinterconnect network 480 is a crossbar that can be configured to connectany of the functional units to any of the registers in the register file420 and connect the LSUs 454 to the register file and memory locationsin shared memory/L1 cache 470.

The shared memory/L1 cache 470 is an array of on-chip memory that allowsfor data storage and communication between the SM 340 and the primitiveengine 335 and between threads in the SM 340. In an embodiment, theshared memory/L1 cache 470 comprises 128 KB of storage capacity and isin the path from the SM 340 to the partition unit 280. The sharedmemory/L1 cache 470 can be used to cache reads and writes. One or moreof the shared memory/L1 cache 470, L2 cache 360, and memory 204 arebacking stores.

Combining data cache and shared memory functionality into a singlememory block provides the best overall performance for both types ofmemory accesses. The capacity is usable as a cache by programs that donot use shared memory. For example, if shared memory is configured touse half of the capacity, texture and load/store operations can use theremaining capacity. Integration within the shared memory/L1 cache 470enables the shared memory/L1 cache 470 to function as a high-throughputconduit for streaming data while simultaneously providing high-bandwidthand low-latency access to frequently reused data.

When configured for general purpose parallel computation, a simplerconfiguration can be used compared with graphics processing.Specifically, the fixed function graphics processing units shown in FIG.2, are bypassed, creating a much simpler programming model. In thegeneral purpose parallel computation configuration, the workdistribution unit 225 assigns and distributes blocks of threads directlyto the DPCs 320. The threads in a block execute the same program, usinga unique thread ID in the calculation to ensure each thread generatesunique results, using the SM 340 to execute the program and performcalculations, shared memory/L1 cache 470 to communicate between threads,and the LSU 454 to read and write global memory through the sharedmemory/L1 cache 470 and the memory partition unit 280. When configuredfor general purpose parallel computation, the SM 340 can also writecommands that the scheduler unit 220 can use to launch new work on theDPCs 320.

The PPU 200 may be included in a desktop computer, a laptop computer, atablet computer, servers, supercomputers, a smart-phone (e.g., awireless, hand-held device), personal digital assistant (PDA), a digitalcamera, a vehicle, a head mounted display, a hand-held electronicdevice, and the like. In an embodiment, the PPU 200 is embodied on asingle semiconductor substrate. In another embodiment, the PPU 200 isincluded in a system-on-a-chip (SoC) along with one or more otherdevices such as additional PPUs 200, the memory 204, a reducedinstruction set computer (RISC) CPU, a memory management unit (MMU), adigital-to-analog converter (DAC), and the like.

In an embodiment, the PPU 200 may be included on a graphics card thatincludes one or more memory devices 204. The graphics card may beconfigured to interface with a PCIe slot on a motherboard of a desktopcomputer. In yet another embodiment, the PPU 200 may be an integratedgraphics processing unit (iGPU) or parallel processor included in thechipset of the motherboard.

Exemplary Computing System

Systems with multiple GPUs and CPUs are used in a variety of industriesas developers expose and leverage more parallelism in applications suchas artificial intelligence computing. High-performance GPU-acceleratedsystems with tens to many thousands of compute nodes are deployed indata centers, research facilities, and supercomputers to solve everlarger problems. As the number of processing devices within thehigh-performance systems increases, the communication and data transfermechanisms need to scale to support the increased bandwidth.

FIG. 4B is a conceptual diagram of a processing system 400 implementedusing the PPU 200 of FIG. 2, in accordance with an embodiment. Theexemplary system 465 may be configured to implement the method 100 shownin FIG. 1. The processing system 400 includes a CPU 430, switch 410, andmultiple PPUs 200 each and respective memories 204. The NVLink 210provides high-speed communication links between each of the PPUs 200.Although a particular number of NVLink 210 and interconnect 202connections are illustrated in FIG. 4B, the number of connections toeach PPU 200 and the CPU 430 may vary. The switch 410 interfaces betweenthe interconnect 202 and the CPU 430. The PPUs 200, memories 204, andNVLinks 210 may be situated on a single semiconductor platform to form aparallel processing module 425. In an embodiment, the switch 410supports two or more protocols to interface between various differentconnections and/or links.

In another embodiment (not shown), the NVLink 210 provides one or morehigh-speed communication links between each of the PPUs 200 and the CPU430 and the switch 410 interfaces between the interconnect 202 and eachof the PPUs 200. The PPUs 200, memories 204, and interconnect 202 may besituated on a single semiconductor platform to form a parallelprocessing module 425. In yet another embodiment (not shown), theinterconnect 202 provides one or more communication links between eachof the PPUs 200 and the CPU 430 and the switch 410 interfaces betweeneach of the PPUs 200 using the NVLink 210 to provide one or morehigh-speed communication links between the PPUs 200. In anotherembodiment (not shown), the NVLink 210 provides one or more high-speedcommunication links between the PPUs 200 and the CPU 430 through theswitch 410. In yet another embodiment (not shown), the interconnect 202provides one or more communication links between each of the PPUs 200directly. One or more of the NVLink 210 high-speed communication linksmay be implemented as a physical NVLink interconnect or either anon-chip or on-die interconnect using the same protocol as the NVLink210.

In the context of the present description, a single semiconductorplatform may refer to a sole unitary semiconductor-based integratedcircuit fabricated on a die or chip. It should be noted that the termsingle semiconductor platform may also refer to multi-chip modules withincreased connectivity which simulate on-chip operation and makesubstantial improvements over utilizing a conventional busimplementation. Of course, the various circuits or devices may also besituated separately or in various combinations of semiconductorplatforms per the desires of the user. Alternately, the parallelprocessing module 425 may be implemented as a circuit board substrateand each of the PPUs 200 and/or memories 204 may be packaged devices. Inan embodiment, the CPU 430, switch 410, and the parallel processingmodule 425 are situated on a single semiconductor platform.

In an embodiment, the signaling rate of each NVLink 210 is 20 to 25Gigabits/second and each PPU 200 includes six NVLink 210 interfaces (asshown in FIG. 4B, five NVLink 210 interfaces are included for each PPU200). Each NVLink 210 provides a data transfer rate of 25Gigabytes/second in each direction, with six links providing 300Gigabytes/second. The NVLinks 210 can be used exclusively for PPU-to-PPUcommunication as shown in FIG. 4B, or some combination of PPU-to-PPU andPPU-to-CPU, when the CPU 430 also includes one or more NVLink 210interfaces.

In an embodiment, the NVLink 210 allows direct load/store/atomic accessfrom the CPU 430 to each PPU's 200 memory 204. In an embodiment, theNVLink 210 supports coherency operations, allowing data read from thememories 204 to be stored in the cache hierarchy of the CPU 430,reducing cache access latency for the CPU 430. In an embodiment, theNVLink 210 includes support for Address Translation Services (ATS),allowing the PPU 200 to directly access page tables within the CPU 430.One or more of the NVLinks 210 may also be configured to operate in alow-power mode.

FIG. 4C illustrates an exemplary system 465 in which the variousarchitecture and/or functionality of the various previous embodimentsmay be implemented. The exemplary system 465 may be configured toimplement the method 100 shown in FIG. 1.

As shown, a system 465 is provided including at least one centralprocessing unit 430 that is connected to a communication bus 475. Thecommunication bus 475 may be implemented using any suitable protocol,such as PCI (Peripheral Component Interconnect), PCI-Express, AGP(Accelerated Graphics Port), HyperTransport, or any other bus orpoint-to-point communication protocol(s). The system 465 also includes amain memory 440. Control logic (software) and data are stored in themain memory 440 which may take the form of random access memory (RAM).

The system 465 also includes input devices 460, the parallel processingsystem 425, and display devices 445, i.e. a conventional CRT (cathoderay tube), LCD (liquid crystal display), LED (light emitting diode),plasma display or the like. User input may be received from the inputdevices 460, e.g., keyboard, mouse, touchpad, microphone, and the like.Each of the foregoing modules and/or devices may even be situated on asingle semiconductor platform to form the system 465. Alternately, thevarious modules may also be situated separately or in variouscombinations of semiconductor platforms per the desires of the user.

Further, the system 465 may be coupled to a network (e.g., atelecommunications network, local area network (LAN), wireless network,wide area network (WAN) such as the Internet, peer-to-peer network,cable network, or the like) through a network interface 435 forcommunication purposes.

The system 465 may also include a secondary storage (not shown). Thesecondary storage includes, for example, a hard disk drive and/or aremovable storage drive, representing a floppy disk drive, a magnetictape drive, a compact disk drive, digital versatile disk (DVD) drive,recording device, universal serial bus (USB) flash memory. The removablestorage drive reads from and/or writes to a removable storage unit in awell-known manner.

Computer programs, or computer control logic algorithms, may be storedin the main memory 440 and/or the secondary storage. Such computerprograms, when executed, enable the system 465 to perform variousfunctions. The memory 440, the storage, and/or any other storage arepossible examples of computer-readable media.

The architecture and/or functionality of the various previous figuresmay be implemented in the context of a general computer system, acircuit board system, a game console system dedicated for entertainmentpurposes, an application-specific system, and/or any other desiredsystem. For example, the system 465 may take the form of a desktopcomputer, a laptop computer, a tablet computer, servers, supercomputers,a smart-phone (e.g., a wireless, hand-held device), personal digitalassistant (PDA), a digital camera, a vehicle, a head mounted display, ahand-held electronic device, a mobile phone device, a television,workstation, game consoles, embedded system, and/or any other type oflogic.

While various embodiments have been described above, it should beunderstood that they have been presented by way of example only, and notlimitation. Thus, the breadth and scope of a preferred embodiment shouldnot be limited by any of the above-described exemplary embodiments, butshould be defined only in accordance with the following claims and theirequivalents.

Graphics Processing Pipeline

In an embodiment, the PPU 200 comprises a graphics processing unit(GPU). The PPU 200 is configured to receive commands that specify shaderprograms for processing graphics data. Graphics data may be defined as aset of primitives such as points, lines, triangles, quads, trianglestrips, and the like. Typically, a primitive includes data thatspecifies a number of vertices for the primitive (e.g., in a model-spacecoordinate system) as well as attributes associated with each vertex ofthe primitive. The PPU 200 can be configured to process the graphicsprimitives to generate a frame buffer (i.e., pixel data for each of thepixels of the display).

An application writes model data for a scene (i.e., a collection ofvertices and attributes) to a memory such as a system memory or memory204. The model data defines each of the objects that may be visible on adisplay. The application then makes an API call to the driver kernelthat requests the model data to be rendered and displayed. The driverkernel reads the model data and writes commands to the one or morestreams to perform operations to process the model data. The commandsmay reference different shader programs to be implemented on the SMs 340of the PPU 200 including one or more of a vertex shader, hull shader,domain shader, geometry shader, and a pixel shader. For example, one ormore of the SMs 340 may be configured to execute a vertex shader programthat processes a number of vertices defined by the model data. In anembodiment, the different SMs 340 may be configured to execute differentshader programs concurrently. For example, a first subset of SMs 340 maybe configured to execute a vertex shader program while a second subsetof SMs 340 may be configured to execute a pixel shader program. Thefirst subset of SMs 340 processes vertex data to produce processedvertex data and writes the processed vertex data to the L2 cache 360and/or the memory 204. After the processed vertex data is rasterized(i.e., transformed from three-dimensional data into two-dimensional datain screen space) to produce fragment data, the second subset of SMs 340executes a pixel shader to produce processed fragment data, which isthen blended with other processed fragment data and written to the framebuffer in memory 204. The vertex shader program and pixel shader programmay execute concurrently, processing different data from the same scenein a pipelined fashion until all of the model data for the scene hasbeen rendered to the frame buffer. Then, the contents of the framebuffer are transmitted to a display controller for display on a displaydevice.

FIG. 5 is a conceptual diagram of a graphics processing pipeline 500implemented by the PPU 200 of FIG. 2, in accordance with an embodiment.The graphics processing pipeline 500 is an abstract flow diagram of theprocessing steps implemented to generate 2D computer-generated imagesfrom 3D geometry data. As is well-known, pipeline architectures mayperform long latency operations more efficiently by splitting up theoperation into a plurality of stages, where the output of each stage iscoupled to the input of the next successive stage. Thus, the graphicsprocessing pipeline 500 receives input data 501 that is transmitted fromone stage to the next stage of the graphics processing pipeline 500 togenerate output data 502. In an embodiment, the graphics processingpipeline 500 may represent a graphics processing pipeline defined by theOpenGL® API. As an option, the graphics processing pipeline 500 may beimplemented in the context of the functionality and architecture of theprevious Figures and/or any subsequent Figure(s).

As shown in FIG. 5, the graphics processing pipeline 500 comprises apipeline architecture that includes a number of stages. The stagesinclude, but are not limited to, a data assembly stage 510, a vertexshading stage 520, a primitive assembly stage 530, a geometry shadingstage 540, a viewport scale, cull, and clip (VSCC) stage 550, arasterization stage 560, a fragment shading stage 570, and a rasteroperations stage 580. In an embodiment, the input data 501 comprisescommands that configure the processing units to implement the stages ofthe graphics processing pipeline 500 and geometric primitives (e.g.,points, lines, triangles, quads, triangle strips or fans, etc.) to beprocessed by the stages. The output data 502 may comprise pixel data(i.e., color data) that is copied into a frame buffer or other type ofsurface data structure in a memory.

The data assembly stage 510 receives the input data 501 that specifiesvertex data for high-order surfaces, primitives, or the like. The dataassembly stage 510 collects the vertex data in a temporary storage orqueue, such as by receiving a command from the host processor thatincludes a pointer to a buffer in memory and reading the vertex datafrom the buffer. The vertex data is then transmitted to the vertexshading stage 520 for processing.

The vertex shading stage 520 processes vertex data by performing a setof operations (i.e., a vertex shader or a program) once for each of thevertices. Vertices may be, e.g., specified as a 4-coordinate vector(i.e., <x, y, z, w>) associated with one or more vertex attributes(e.g., color, texture coordinates, surface normal, etc.). The vertexshading stage 520 may manipulate individual vertex attributes such asposition, color, texture coordinates, and the like. In other words, thevertex shading stage 520 performs operations on the vertex coordinatesor other vertex attributes associated with a vertex. Such operationscommonly including lighting operations (i.e., modifying color attributesfor a vertex) and transformation operations (i.e., modifying thecoordinate space for a vertex). For example, vertices may be specifiedusing coordinates in an object-coordinate space, which are transformedby multiplying the coordinates by a matrix that translates thecoordinates from the object-coordinate space into a world space or anormalized-device-coordinate (NCD) space. The vertex shading stage 520generates transformed vertex data that is transmitted to the primitiveassembly stage 530.

The primitive assembly stage 530 collects vertices output by the vertexshading stage 520 and groups the vertices into geometric primitives forprocessing by the geometry shading stage 540. For example, the primitiveassembly stage 530 may be configured to group every three consecutivevertices as a geometric primitive (i.e., a triangle) for transmission tothe geometry shading stage 540. In some embodiments, specific verticesmay be reused for consecutive geometric primitives (e.g., twoconsecutive triangles in a triangle strip may share two vertices). Theprimitive assembly stage 530 transmits geometric primitives (i.e., acollection of associated vertices) to the geometry shading stage 540.

The geometry shading stage 540 processes geometric primitives byperforming a set of operations (i.e., a geometry shader or program) onthe geometric primitives. Tessellation operations may generate one ormore geometric primitives from each geometric primitive. In other words,the geometry shading stage 540 may subdivide each geometric primitiveinto a finer mesh of two or more geometric primitives for processing bythe rest of the graphics processing pipeline 500. The geometry shadingstage 540 transmits geometric primitives to the viewport SCC stage 550.

In an embodiment, the graphics processing pipeline 500 may operatewithin a streaming multiprocessor and the vertex shading stage 520, theprimitive assembly stage 530, the geometry shading stage 540, thefragment shading stage 570, and/or hardware/software associatedtherewith, may sequentially perform processing operations. Once thesequential processing operations are complete, in an embodiment, theviewport SCC stage 550 may utilize the data. In an embodiment, primitivedata processed by one or more of the stages in the graphics processingpipeline 500 may be written to a cache (e.g. L1 cache, a vertex cache,etc.). In this case, in an embodiment, the viewport SCC stage 550 mayaccess the data in the cache. In an embodiment, the viewport SCC stage550 and the rasterization stage 560 are implemented as fixed functioncircuitry.

The viewport SCC stage 550 performs viewport scaling, culling, andclipping of the geometric primitives. Each surface being rendered to isassociated with an abstract camera position. The camera positionrepresents a location of a viewer looking at the scene and defines aviewing frustum that encloses the objects of the scene. The viewingfrustum may include a viewing plane, a rear plane, and four clippingplanes. Any geometric primitive entirely outside of the viewing frustummay be culled (i.e., discarded) because the geometric primitive will notcontribute to the final rendered scene. Any geometric primitive that ispartially inside the viewing frustum and partially outside the viewingfrustum may be clipped (i.e., transformed into a new geometric primitivethat is enclosed within the viewing frustum. Furthermore, geometricprimitives may each be scaled based on a depth of the viewing frustum.All potentially visible geometric primitives are then transmitted to therasterization stage 560.

The rasterization stage 560 converts the 3D geometric primitives into 2Dfragments (e.g. capable of being utilized for display, etc.). Therasterization stage 560 may be configured to utilize the vertices of thegeometric primitives to setup a set of plane equations from whichvarious attributes can be interpolated. The rasterization stage 560 mayalso compute a coverage mask for a plurality of pixels that indicateswhether one or more sample locations for the pixel intercept thegeometric primitive. In an embodiment, z-testing may also be performedto determine if the geometric primitive is occluded by other geometricprimitives that have already been rasterized. The rasterization stage560 generates fragment data (i.e., interpolated vertex attributesassociated with a particular sample location for each covered pixel)that are transmitted to the fragment shading stage 570.

The fragment shading stage 570 processes fragment data by performing aset of operations (i.e., a fragment shader or a program) on each of thefragments. The fragment shading stage 570 may generate pixel data (i.e.,color values) for the fragment such as by performing lighting operationsor sampling texture maps using interpolated texture coordinates for thefragment. The fragment shading stage 570 generates pixel data that istransmitted to the raster operations stage 580.

The raster operations stage 580 may perform various operations on thepixel data such as performing alpha tests, stencil tests, and blendingthe pixel data with other pixel data corresponding to other fragmentsassociated with the pixel. When the raster operations stage 580 hasfinished processing the pixel data (i.e., the output data 502), thepixel data may be written to a render target such as a frame buffer, acolor buffer, or the like.

It will be appreciated that one or more additional stages may beincluded in the graphics processing pipeline 500 in addition to or inlieu of one or more of the stages described above. Variousimplementations of the abstract graphics processing pipeline mayimplement different stages. Furthermore, one or more of the stagesdescribed above may be excluded from the graphics processing pipeline insome embodiments (such as the geometry shading stage 540). Other typesof graphics processing pipelines are contemplated as being within thescope of the present disclosure. Furthermore, any of the stages of thegraphics processing pipeline 500 may be implemented by one or morededicated hardware units within a graphics processor such as PPU 200.Other stages of the graphics processing pipeline 500 may be implementedby programmable hardware units such as the SM 340 of the PPU 200.

The graphics processing pipeline 500 may be implemented via anapplication executed by a host processor, such as a CPU. In anembodiment, a device driver may implement an application programminginterface (API) that defines various functions that can be utilized byan application in order to generate graphical data for display. Thedevice driver is a software program that includes a plurality ofinstructions that control the operation of the PPU 200. The API providesan abstraction for a programmer that lets a programmer utilizespecialized graphics hardware, such as the PPU 200, to generate thegraphical data without requiring the programmer to utilize the specificinstruction set for the PPU 200. The application may include an API callthat is routed to the device driver for the PPU 200. The device driverinterprets the API call and performs various operations to respond tothe API call. In some instances, the device driver may performoperations by executing instructions on the CPU. In other instances, thedevice driver may perform operations, at least in part, by launchingoperations on the PPU 200 utilizing an input/output interface betweenthe CPU and the PPU 200. In an embodiment, the device driver isconfigured to implement the graphics processing pipeline 500 utilizingthe hardware of the PPU 200.

Various programs may be executed within the PPU 200 in order toimplement the various stages of the graphics processing pipeline 500.For example, the device driver may launch a kernel on the PPU 200 toperform the vertex shading stage 520 on one SM 340 (or multiple SMs340). The device driver (or the initial kernel executed by the PPU 300)may also launch other kernels on the PPU 300 to perform other stages ofthe graphics processing pipeline 500, such as the geometry shading stage540 and the fragment shading stage 570. In addition, some of the stagesof the graphics processing pipeline 500 may be implemented on fixed unithardware such as a rasterizer or a data assembler implemented within thePPU 300. It will be appreciated that results from one kernel may beprocessed by one or more intervening fixed function hardware unitsbefore being processed by a subsequent kernel on an SM 340.

Machine Learning

Deep neural networks (DNNs) developed on processors, such as the PPU 200have been used for diverse use cases, from self-driving cars to fasterdrug development, from automatic image captioning in online imagedatabases to smart real-time language translation in video chatapplications. Deep learning is a technique that models the neurallearning process of the human brain, continually learning, continuallygetting smarter, and delivering more accurate results more quickly overtime. A child is initially taught by an adult to correctly identify andclassify various shapes, eventually being able to identify shapeswithout any coaching. Similarly, a deep learning or neural learningsystem needs to be trained in object recognition and classification forit get smarter and more efficient at identifying basic objects, occludedobjects, etc., while also assigning context to objects.

At the simplest level, neurons in the human brain look at various inputsthat are received, importance levels are assigned to each of theseinputs, and output is passed on to other neurons to act upon. Anartificial neuron or perceptron is the most basic model of a neuralnetwork. In one example, a perceptron may receive one or more inputsthat represent various features of an object that the perceptron isbeing trained to recognize and classify, and each of these features isassigned a certain weight based on the importance of that feature indefining the shape of an object.

A deep neural network (DNN) model includes multiple layers of manyconnected perceptrons (e.g., nodes) that can be trained with enormousamounts of input data to quickly solve complex problems with highaccuracy. In one example, a first layer of the DLL model breaks down aninput image of an automobile into various sections and looks for basicpatterns such as lines and angles. The second layer assembles the linesto look for higher level patterns such as wheels, windshields, andmirrors. The next layer identifies the type of vehicle, and the finalfew layers generate a label for the input image, identifying the modelof a specific automobile brand.

Once the DNN is trained, the DNN can be deployed and used to identifyand classify objects or patterns in a process known as inference.Examples of inference (the process through which a DNN extracts usefulinformation from a given input) include identifying handwritten numberson checks deposited into ATM machines, identifying images of friends inphotos, delivering movie recommendations to over fifty million users,identifying and classifying different types of automobiles, pedestrians,and road hazards in driverless cars, or translating human speech inreal-time.

During training, data flows through the DNN in a forward propagationphase until a prediction is produced that indicates a labelcorresponding to the input. If the neural network does not correctlylabel the input, then errors between the correct label and the predictedlabel are analyzed, and the weights are adjusted for each feature duringa backward propagation phase until the DNN correctly labels the inputand other inputs in a training dataset. Training complex neural networksrequires massive amounts of parallel computing performance, includingfloating-point multiplications and additions that are supported by thePPU 200. Inferencing is less compute-intensive than training, being alatency-sensitive process where a trained neural network is applied tonew inputs it has not seen before to classify images, translate speech,and generally infer new information.

Neural networks rely heavily on matrix math operations, and complexmulti-layered networks require tremendous amounts of floating-pointperformance and bandwidth for both efficiency and speed. With thousandsof processing cores, optimized for matrix math operations, anddelivering tens to hundreds of TFLOPS of performance, the PPU 200 is acomputing platform capable of delivering performance required for deepneural network-based artificial intelligence and machine learningapplications.

Compressing 1D Time-Channel Separable Convolutions Using Sparse RandomTernary Matrices

Speech and command recognition tasks tend to have strict low-latencyrequirements, which may be challenging to meet while using deep neuralnetworks. Specifically, the employment of such networks on edge devices,which are bandwidth, energy, and area constrained, is often too costlyin practical applications. Sparsity and quantization techniques areviable solutions, reducing the model size and computational cost whilebeing suited for existing hardware.

With this motivation in mind, sparsity and quantization may be combinedto make compact speech and command recognition models even more compact.In particular, residual networks containing time-channel separableconvolutions may be leveraged. Despite such compact designs, mostweights are on the 1×1-convolutions in the residual paths, which areequivalent to fully-connected layers applied to every time step. Thememory and computational cost of these models may be decreased byreplacing trained floating-point weights by constant, sparse randomternary matrices.

This approach enables (i) faster training, since the weights need not beupdated, (ii) faster on-chip inference, due to sparse, low-precisionoperations with no multiplications, and (iii) higher compression rates,because weights may not be stored but just computed on-the-fly resultingin (iv) reduced memory bandwidth.

Random Ternary Matrices

By analyzing the weights of the 1×1-convolutions in the sequence ofresidual blocks, it may be observed that they do not expose any obviousvisual structure. Specifically, after applying trained ternarizedquantization, the resulting trained matrices maintain model performanceeven though they can hardly be distinguished from random ternarymatrices.

Neural networks with random weights show powerful capabilities.Therefore, random ternarized matrices may be used instead of1×1-convolutions in the residual blocks by keeping them constant whiletraining the rest of the network. For each neuron, the ternarizedweights simply compute a scaled difference of sums:

${{ReLU}( {{BN}( {{\sum\limits_{i \in I^{+}}x_{i}} - {\sum\limits_{i \in I^{-}}x_{i}}} )} )},$

where the set I⁺ contains all the indices of the connections with theweight+1 and I⁻ contains all the indices of the connections with theweight −1. The union I:=I⁻∪I⁺ may be sparse, i.e. may not contain theindices of all neurons in the previous layer. This scaled sum is a farcheaper operation than the traditional floating-point matrixmultiplication.

Similar to echo state networks, a sufficient routing capacity is enabledby having trained layers before and after the constant random ternarylayers. This matches observations that note that starting quantizationtoo early in the network degrades performance. With this in mind, onlyternarization is performed, and the weights in the 1×1-convolutions arenot updated inside the residual blocks (which possess the majority ofthe weights).

Since the weights of the preceding temporal-convolution and thesubsequent batch normalization layers are still updated, a scaling ofthe inputs and outputs may be learned, respectively. Implicitly, thetensor product of the aforementioned scaling vectors may define theweights of the ternary matrix, empowering this approach. The ternarymatrix in combination with batch normalization is reminiscent ofoperational amplifiers, computing a difference of sums that is amplifiedbefore applying a non-linearity, e.g. ReLU. Moreover, the algorithm isrelated to extreme learning machines, where a more theoreticalfoundation can be derived.

Exemplary Implementation Details

Given a randomly initialized matrix, the random (and constant) ternarymatrix may be generated by applying a thresholding procedure. Aparameter t then serves as a threshold, where all absolute values lessthan t are quantized to zero and the remaining values are quantized to−1 and +1 according to their sign. If the matrices are initialized usinguniformly distributed samples from [−1; 1], t∈[0, 1] will be theexpected fraction of sparsity of the matrix: t=0 yields a dense, binarymatrix, t=1 yields a zero matrix, and t∈]0, 1[ yields a ternary matrix.

An exemplary implementation of this approach is shown below (given auniformly distributed weight from [−1; 1] and a threshold t∈[0, 1]:

-   -   # compute signs    -   pos=(weight.data>0.).int 2 ( )    -   neg=(weight.data<0.).int 2 ( )    -   # compute sparsity mask    -   mask=(torch. abs(weight.data)>t).int 2 ( )    -   # make ternary    -   weight.data=(pos−neg)*mask    -   # do not update weight during training    -   weight. requires_grad=False

Implementation Variants

The above implementations may be widely applicable and suited toexisting hardware, allowing for a range of efficient implementations.Specifically, the random ternary matrices may be computed on-the-fly onthe chip without accessing memory for weights. For example, apseudo-random number generator may be used to determine the ternaryvalues, where, given an initial state, a specific matrix may bedeterministically generated at any time. Alternatively, each ternaryvalue may be determined by a hash function of the matrix entrycoordinates, where different matrices may be realized by different hashfunctions.

Specific structured sparsity patterns supported by certain acceleratorsmay be applied instead, taking full advantage of hardware support.Further, compute acceleration in the ternary layers may be leveraged bycustom layer implementations.

Implementing a Linear Neural Network

Artificial neural networks (ANNs) are computing systems that imitate ahuman brain by learning to perform tasks by considering examples. TheseANNs are typically created by connecting several layers of neural unitsusing connections, where each neural unit is connected to every otherneural unit either directly or indirectly to create fully connectedlayers within the ANN. However, by representing an artificial neuralnetwork utilizing paths from an input of the ANN to an output of theANN, a complexity of the ANN may be reduced, and the ANN may be trainedand implemented in a much faster manner when compared to fully connectedlayers within the ANN.

In one embodiment, a linear neural network may be implemented. Forexample, an artificial neural network (ANN) may be created that isrepresented by a plurality of paths each connecting at least one inputof the ANN to at least one output of the ANN. Additionally, each of theplurality of paths includes a plurality of vertices each representing aneural unit within the ANN, and a plurality of edges each representing aweighted connection within the ANN.

In one embodiment, input data is processed by the ANN to produce outputdata. In another embodiment, the input data may include one or more ofimage data, textual data, audio data, video data, random numbers,pseudo-random numbers, or quasi-random numbers, etc. In anotherembodiment, an embedding function may be used to map input data to avector of floating point values to be processed by the ANN. In anotherembodiment, an embedding may be represented by an artificial neuralnetwork itself. In another embodiment, the output data may include oneor more of a classification, a categorization, a probability, aregression, function approximation, samples of data according to alearned distribution (e.g. generative adversarial networks (GANs)), etc.In yet another embodiment, the input data may include environmental data(e.g., recorded image data of an environment surrounding an automobile,etc.), and the output data may include an identification/classificationof one or more objects within the environmental data (such as cars,cyclists, pedestrians, etc.).

In yet another embodiment, the ANN is trained, utilizing labeled inputtraining data. For example, the training may be semi-supervised,unsupervised, etc. In yet another embodiment, the ANN is at the heart ofa reinforcement learning machine to take actions and approximate avalue. In this case the ANN is trained in a semi-supervised way byperforming a simulation of a Markov chain. In yet another way, the ANNis used to predict the next item of data and is trained in anunsupervised way by providing training data that includes the next datato be predicted.

Additionally, in one embodiment, each of the plurality of paths mayinclude a sequence of paths. In another embodiment, the sequence ofpaths may be partitioned into a plurality of contiguous blocks to createa series of artificial neural networks represented by the sequence ofpaths. In yet another embodiment, each of the plurality of paths may begenerated by performing one or more of random sampling, pseudo-randomsampling, and quasi-random sampling. In another embodiment, thepseudo-random sampling and quasi-random sampling may be performed inhardware. In yet another embodiment parts of the paths may be given andmissing parts may be generated as described before. In yet anotherembodiment, the paths may be generated path by path or generation bygeneration, i.e. simultaneously one step at a time for all paths.

Further, in one embodiment, the sampling may be performed on anotherANN. In another embodiment, the sampling may be performed on fullyconnected layers of an ANN in order to determine the plurality of paths.In yet another embodiment, the plurality of paths may include one ormore of a subset of all possible paths within the fully connected layersof the ANN or the convolutional layers of the ANN.

For example, the other ANN may include a plurality of layers, where eachlayer includes a grouping of neural units (e.g., vertices). If the otherANN is fully connected, each neural unit (vertex) within a layer isconnected (via an edge) to all neural units of a preceding layer as wellas all neural units of a subsequent layer within the other ANN. Theseconnections are called edges. In this way, all neural units of a fullyconnected ANN are either directly or indirectly connected to each other.

Additionally, the paths may be generated by sampling a subset of allconnections (edges) between the layers of neural units within the otherANN. For instance, between an input layer and a first layer within theother ANN, an edge may be sampled that connects a vertex within theinput layer to a vertex of the first layer. An edge may then be sampledthat connects the vertex of the first layer to a vertex of a secondlayer within the other ANN. This may be continued until a complete pathis sampled that connects, via edges, the vertex within the input layerto a vertex of the output layer of the ANN, utilizing one vertex fromeach intermediate layer of the ANN. This may be performed for allvertices of the input layer and all vertices of the output layer andeach vertex of the input layer of the other ANN is connected via acomplete path of edges via the intermediate layers of the ANN to aunique vertex of the output layer.

Further still, in one embodiment, the network may be created byuniformly sampling paths, utilizing an arbitrary network graph. Inanother embodiment, the arbitrary network graph may include an untrainedANN. In yet another embodiment, the plurality of paths may be selectedfrom the untrained ANN, and may be used to create another ANN thatrepresents the untrained ANN. In still another embodiment, this otherANN may then be trained.

Also, in one embodiment, the weighted connections may be initializeddeterministically. For example, each of the weighted connections withinthe ANN may be initialized with a constant value. In another embodiment,the weighted connections may be initialized with a value from a lowdiscrepancy sequence.

In addition, in one embodiment, the ANN may be created by sampling theplurality of paths proportional to a plurality of given weights oflayers of the ANN. In another embodiment, the weights of a layer may besubsampled individually or in their entirety. In another embodiment,sampling the plurality of paths may include subsampling convolutionalweights. In yet another embodiment, convolutional weights may besubsampled individually per filter or in their entirety. In stillanother embodiment, the plurality of paths may be selected such that theresulting network may be computed without performing any weightmultiplications.

Furthermore, in one embodiment, the ANN is created by sampling theplurality of paths proportional to a plurality of given activations oflayers of the ANN. In another embodiment, the plurality of paths isselected proportional to the plurality of given activations during atleast one of a training of the ANN and an inference performed utilizingthe ANN. In yet another embodiment, the plurality of paths may beselected in a manner proportional to an error during back propagation.In still another embodiment, the plurality of paths may be selected suchthat the resulting network may be computed without performing anyactivation multiplications.

Further still, in one embodiment, the plurality of paths may be selectedwithout performing any multiplications by weights, or without performingany multiplications by activations. In another embodiment, the ANN maybe created by sampling the plurality of paths proportional to both aplurality of given weights and a plurality of given activations oflayers of the ANN. In yet another embodiment, the ANN may be a recurrentnetwork.

In yet another embodiment, the ANN may be created, trained, and/orimplemented utilizing the parallel processing unit (PPU) 200 of FIG. 2.

In this way, neural networks may be represented utilizing paths.Additionally, a complexity of a neural network may be reduced fromquadratic to linear. Further, sampling may be performed proportionallyto discrete densities/weights within the ANN. Further still, samplingmay be performed proportional to activations within the ANN. Also,weights of a neural network may be normalized, and the normalizedweights may be propagated. In addition, network partitioning may beperformed, and weights may be sub-sampled from a fullyconnected/convolutional neural network.

Artificial Neural Networks with Linear Complexity

Overview

The average human brain has about 10¹¹ nerve cells, where each of themmay be connected to up to 10⁴ others. We therefore investigate thequestion of whether there are algorithms for artificial neural networksthat are linear in the number of neural units. Combining artificialneural networks and Monte Carlo and quasi-Monte Carlo methods allows oneto derive general sampling-based algorithms for inference, training,compression, and quantization that are of linear complexity and havestate of the art performance.

Introduction

Artificial neural networks are composed of neural units that areintended to imitate biological neurons. Such a neural unit computes anon-linear function of the weighted sum of the signals at its inputs. Ifevery mentioned neural unit was connected to every other neural unit,the computation effort would be of quadratic complexity. However, it isknown that not every neuron is connected to every other neuron in thebrain. Even more so, the number of inputs to a neuron is bounded by aconstant much smaller than the actual number of neurons.

Artificial neural networks may contain so-called fully connected layers,where each neural unit of a layer is connected to every neural unit ofthe next layer. A large number of experiments have shown that largenumbers of connections have little contribution to the end result andmay be pruned without affecting the function of the artificial neuralnetwork.

The weighted sum at the heart of a neural unit may be considered ascalar product or quadrature rule. Interpreting neural units asnumerical integration algorithms, the principles of Monte Carlo andquasi-Monte Carlo methods may be applied to derive algorithms of linearcomplexity.

Applying the principle of discrete density simulation allows forderiving algorithms of linear complexity for artificial neural networks.Representing artificial neural networks by paths, they may be trainedmuch faster than conventional representations, and in addition may betrained in a sparse from scratch manner. As a consequence of sparsity,deterministic initialization becomes possible. Additionally, analgorithm may be derived that subsamples an artificial neural networksuch that the weights are only {−1, 0, 1} and its complexity is linearin time and space in the number of neural units. Also, online sparsitymay be obtained by subsampling the activations.

Simulating Discrete Densities

Scalar products are the defining operation of Hilbert spaces and are thebasis of linear algorithms. They are at the core of machine learning andespecially prominent in neural units, where a weighted sum of inputs iscomputed which is then passed as argument to a non-linear function (forexample, see Equation 2 below).

In what follows, we review how to evaluate scalar products using randomand deterministic sampling, which is the basis for increasing theefficiency of artificial neural networks. See for example, “Massivelyparallel construction of radix tree forests for the efficient samplingof discrete probability distributions,” by Binder et al., whichdiscusses advanced algorithms for sampling discrete probabilitydistributions, and which is herein incorporated by reference in itsentirety.

Without loss of generality, we assume a normalized set of weights, suchthat the absolute values of the weights add up to one, i.e.:

${\sum\limits_{k = 0}^{n - 1}{w_{k}}} = {{w}_{1} = 1.}$

If the weights are not normalized, we use weights

$\frac{w_{k}}{{w}_{1}}$

instead and assume that ∥w∥₁≠0.

The absolute values of the weights then form a partition of the unitinterval, where

Given N uniformly distributed samples x_(i)∈[0, 1), this procedureallows one to approximate a scalar product

$\begin{matrix}{{{\sum\limits_{k = 0}^{n - 1}\;{w_{k}a_{k}}} \approx {\frac{1}{N}{\sum\limits_{i = 0}^{N - 1}\;{{{sign}( w_{j_{i}} )} \cdot a_{j_{i}}}}}},} & (1)\end{matrix}$

where the index j_(i)∈{0, . . . , n−1} is uniquely determined by P_(j)_(i) ⁻¹≤x_(i)<P_(j) _(i) , as this satisfies that j_(i) is chosen withthe probability |w_(j) _(i) |. a=(a₀, . . . , a_(n-1)) is a given vectorof inputs.

If the x_(i) are random numbers, then the procedure is the Monte Carlointegration of a scalar product by simulating the discrete density givenby the absolute values of the normalized weights. It amounts toquantizing the weights to values in {−1, 0, +1}.

The quality of the approximation may be improved by selecting samplesx_(i) with improved uniform distribution. A deterministic choice wouldbe low discrepancy sequences and a simple randomized alternative isjittered equidistant sampling, where:

$x_{i} = \frac{i + \xi}{N}$

for one realization of the random variable ξ∈[0, 1). Sorting the weightsprior to taking their absolute values improves the approximationquality.

Note that larger weights may be sampled multiple times. This case may beoptimized by counting how many references were made and multiplying thecorresponding activation by the number of references instead of loopingover the references.

On the other hand, duplicate references may rarely happen unless theweights vary largely. A crude approximation that ignores multiplereferences may work well in such cases. Alternatively, one may search anumber of samples such that the resulting quantization is truly ternary(or binary) without duplicates. In another embodiment, the number ofmaximum bits to count duplicates may be fixed and samples may be addeduntil this maximum representable count is reached. In yet anotherembodiment, counting may be continued beyond the maximum representablecount by accepting a resulting truncation error.

Sampling according to a distribution also may be implemented on parallelsystems and if the weights are only available sequentially. Due tocancellation and rounding, an implementation in floating point numbersmay not necessarily yield ∥w∥=1 and care has to be taken to catch suchcases. A practical workaround is to take the actual sum to scale therandom variable.

Artificial Neural Networks

An example directed graph 600 of an artificial neural network isillustrated in FIG. 6. As shown, given the input vector a₀ 602A-N, anoutput vector a_(L) 604A-N is determined by the neural units a_(l,i)606A-N and 608A-N. Each neural unit in a layer l computes a weighted sumof the activations in the previous layer l−1 and applies an activationfunction that fixes its output.

There are L layers with n_(l) neural units in l-th layer. Given weightsw_(l,k,i) and inputs activations a_(0,k) the output of a neural unit iscomputed as:

$\begin{matrix}{a_{l,i}:={\max{\{ {0,{{\sum\limits_{k = 0}^{n_{l - 1} - 1}\;{w_{l,k,i}a_{{l - 1},k}}} - b_{l,i}}} \}.}}} & (2)\end{matrix}$

Thus one neural unit computes a weighted sum of the input activations,and applies a non-linear function to the weighted sum. The term b_(l,i)is called bias and together with ReLU may be understood as a thresholdcompared to the weighted sum for activation.

Properties of the Rectified Linear Unit (ReLU)

While there are many choices for the non-linear output function of aneural unit, we focus on:

ReLU(x):=max{0,x},

and review some properties of neural units using the rectified linearunit function (ReLU). In fact, the ReLU activation function may be atthe core of many functions used in artificial neural networks.

Leaky ReLU

For example, the leaky ReLU is defined by:

ReLU(x)−α·ReLU(−x).

Max-Pooling

For α=−1 the leaky ReLU results to be the absolute value

|x|=ReLU(x)+ReLU(−x),

which in turn may be used to represent the maximum of two values:

${\max\{ {x,y} \}} = {{\frac{x + y}{2} + {\frac{x - y}{2}}} = {\frac{1}{2} \cdot ( {x + y + {{ReLU}( {x - y} )} + {{ReLU}( {y - x} )}} )}}$

By induction, the maximum of two values may be extended to the maximumof an arbitrary number of values. More importantly, the identities showthat computing the maximum may be represented by the ReLU activationfunction and thus may represent an optimization in an artificial neuralnetwork that does not need to be learned. A second consequence of thisrepresentation is the introduction of skip links, i.e. passing an inputthrough one layer of a neural network.

Residual Layers

There is a strong connection between neural units and projectionmethods. Given a half space H⁺ defined by a normal vector ŵ and aperpendicular distance from the origin b, the projection of a point xonto that half space is given by

$\begin{matrix}{{P_{H} + (x)}:={{x - {\min{\{ {0,{\langle {\hat{w},x} \rangle - b}} \} \cdot \hat{w}}}} = {x - {{{ReLU}( {\langle {\hat{w},x} \rangle - b} )} \cdot {\hat{w}.}}}}} & (3)\end{matrix}$

This is illustrated in FIG. 7, which is an interpretation 700 ofprojections onto halfspaces as ReLU neural units. As shown, thehalfspace H⁺ 702 is defined by the vector of weights ŵ 704 as normal anda bias term b 706, which represents the distance of the plane from theorigin O 708. Since x₁∉H⁺, the x₁ 710 is moved onto the boundary of H⁺702 along the uniquely defined shortest distance vector, i.e. along thedirection ŵ704. For x₂ nothing is to be done, as already x₂∈H⁺ and henceP_(H)+(x₂) x₂.

This may be used in adaptive projective subgradient methods forclassification problems. In fact, the term ReLU(

ŵ, x

−b) translates into an if-clause that performs the projection, if thescalar product

ŵ, x

is larger than a threshold b.

Note that usually the bias term is added (compare Equation 2). However,with the interpretation of the bias term as the distance from theorigin, subtraction is more natural. The half space interpretation alsoprovides some intuition about zero and non-zero bias: While non-zerobias allows one to construct finite convex sets, zero bias means thatall planes of half spaces must intersect in the origin and hence therepresentable convex sets are infinite. Note that having one constantnon-zero bias means that all planes have the same perpendicular distancefrom the origin.

Strong relations of residual layers and ordinary differential equationsare provided. Introducing a factor h, a residual layer may be writtenas:

$a_{l} = { {a_{l - 1} + {{h \cdot W_{l}^{(2)}}\max\{ {0,{W_{l}^{(1)} \cdot a_{l - 1}}} \}}}\Leftrightarrow\frac{a_{l} - a_{l - 1}}{h}  = {W_{l}^{(2)}\max\{ {0,{W_{l}^{(1)} \cdot a_{l - 1}}} \}}}$

and after the equivalence transformation immediately looks like a stepof the Euler method with step size h. With the transition h→0, theleft-hand side becomes {dot over (a)}_(l), which makes a residual layeran ordinary differential equation. This gave rise to trying differentordinary differential equations to determine W_(l) ^((l)) and W_(l) ⁽²⁾on the right-hand side and to perform inference and training usingclassic solvers for ordinary differential equations.

Network Normalization

Given a positive factor ƒ∈

⁺, a neural unit with the ReLU activation function has a scalingproperty:

$\begin{matrix}{{\max\{ {0,{{\sum\limits_{k = 0}^{n_{l - 1} - 1}\;{w_{l,k,i}a_{{l - 1},k}}} - b_{l,i}}} \}} = {{f \cdot \max}\{ {0,\frac{{\sum\limits_{k = 0}^{n_{l - 1} - 1}\;{w_{l,k,i}a_{{l - 1},k}}} - b_{l,i}}{f}} \}}} & (4)\end{matrix}$

Neural units with an activation function that has this scaling propertymay be normalized by selecting the linear factor

$f = {{{w_{l,i}}_{1} + {b_{l,i}}} = {{\sum\limits_{k = 0}^{n_{l - 1} - 1}\;{w_{l,k,i}}} + {b_{l,i}}}}$

such that the absolute values sum up to one. Using

$f = {{w_{l,i}}_{1} = {\sum\limits_{k = 0}^{n_{l - 1} - 1}\;{w_{l,k,i}}}}$

normalizes the absolute value of the weights such that they form adiscrete probability distribution. A whole network may be normalized bystarting to propagate the linear factors from the first layer throughthe network in a feed-forward fashion: The weights of the next layer areupdated by multiplying with the respective linear factors from theprevious layer. The last layer then needs to store the terminal linearfactors for the output neural units. This network normalizationtransformation is deterministic. Considering an artificial neuralnetwork as an approximation operator, network normalization allows oneto control the operator norm.

As shown above, the leaky ReLU, absolute value, and max pooling have apositive linear factor property. Hence artificial neural networks builtfrom them may be normalized as described. Note that for the example ofthe projection methods in Equation 3, we would use the Euclidean norm

ƒ=∥w _(l,i)∥₂:=Σ_(k=0) ^(n) ^(l−1) ⁻¹ |w _(l,k,i)|²

to obtain the normal vectors perpendicular to the plane they describe.The Euclidean norm also has been used to separate the length of a weightvector from its direction in order to accelerate training. It is areplacement for batch normalization.

Linear Algorithms for Artificial Neural Networks

In a fully connected artificial neural network, the number of weights

$n_{w} = {\sum\limits_{l = 1}^{L}\;{n_{l - 1} \cdot n_{l}}}$

is equivalent to the number of connections, where n_(l) is the number ofneural units in layer l. However, in the brain, by far not every neuronis connected to all other neurons. One way to achieve a complexitylinear in the number of neural units

$n = {\sum\limits_{l = 1}^{L}\; n_{l}}$

is to bound the number of connections to a neural unit by a constant. Ina first set of experiments, we sample connections of trained artificialneural networks proportional to the weight distribution of the neuralunits as explained above:

Fully Connected Layers

A sparse artificial neural network may be created by selecting afraction of the connections of a fully connected network by samplingaccording to the weights of each neural unit. In one example, using only12% of the most important weights allows one to reach 97.52% of theaccuracy of the full model. This simple approach already illustrates thepower of subsampling neural networks. For this experiment, we usedequidistant jittered sampling with one random offset per neural unit.

Note that sampling neural units independently may lead to neural unitsor inputs not being connected. In addition, sampling a fraction of theweights is not yet a linear algorithm, although it already emphasizesthe potential of the sampling approach.

Convolutional Layers

For a LeNet architecture on CIFAR-10, our model's best test accuracy is69.12%. Applying subsampling to the convolution weights, we are able toget 88% of accuracy of the full model at only 50% sampled weights. Thegains are smaller as compared to subsampling fully connected layers, asthe number of weights is much smaller and in fact is already bounded bya constant, which is the filter kernel size. Therefore, subsamplingindividual filter kernels may only pay off for larger filter kernels.

However, instead of sampling the weights of each filter one afteranother, sampling across all weights of all filters of a convolutionallayer very much improves the situation. This way the selectedconnections much better represent the ensemble of all filters of aconvolution layer, allowing for increased sparsity.

Partition Instead of Dropout

Dropout is used to regularize the training of artificial neuralnetworks. Given a probability

$\frac{1}{P},$

a neural unit is not considered during training if for a uniformlydistributed random number ξ we have

$\frac{1}{P} > {\xi.}$

Such random number may be efficiently simulated by a linear feedbackshift register generator, for example.

This procedure, however, does not guarantee the coverage of all neuralunits. Assigning a neural unit to exactly one partition p=└ξ·P┘ out ofP∈

partitions uses fewer pseudo-random number generator calls andguarantees that all neural units are considered. See, for example, FIG.8, which compares two instances of dropout 802 and 804 to an instance ofpartition 806.

Except for the improved algorithmic efficiency, nothing is changed asshown in Table 1:

TABLE 1 LeNet on CIFAR-10 $\begin{matrix}{{Dropout}\mspace{14mu}{Average}\mspace{14mu}{over}} \\{\frac{1}{P} = {1\text{/}2\mspace{14mu}{to}\mspace{14mu} 1\text{/}9}}\end{matrix}\quad$ Partitions Average of P = 2 to 9 Mean accuracy 0.60620.6057 StdDev accuracy 0.0106 0.009

Representing Artificial Neural Networks by Paths

With dropout or drop connect, it may happen that the output of a neuralunit is not used, or that a neural unit may not be connected to anyinput. The same may be true for just sampling connections of a neuralunit. However, constructing paths from the inputs to the outputs of anartificial neural network, there cannot be dangling neural units, as allneural units on a path use at least one input and propagate theiroutput. Therefore, the complexity is bounded by the depth of theartificial neural network multiplied by the number of paths and hence islinear in both space and time.

FIG. 9 illustrates exemplary selected paths 902-908 in an artificialneural network 900, according to one exemplary embodiment. As shown, thecomputational complexity of the selected paths 902-908 in both time andspace is bounded by the number of selected paths 902-908 times thenumber L of layers (e.g., the depth of the artificial neural network900).

Table 2 illustrates Exemplary C++ declarations and initialization of thevariables for artificial neural networks represented by paths.LayerOffset[l]=Σ_(i=0) ^(l−1)n_(l) is the index of the first element oflayer l in the activation and error arrays. The paths are eithergenerated as random walks connecting neural units selected by apseudo-random number generator or by a deterministic sequence, whereP[i][l] is the l-th component of the i-th vector of a low discrepancysequence.

TABLE 2 const int InputSize = 784; const int Paths = 4 * InputSize; //example number of const float InitialWeight = 0.01f; // example networktopology const int Layers = 6, NeuronsPerLayer[] = {InputSize, 256, 256int Path[Layers][Paths]; // path length is number of Layers float Weight[Layers][Paths]; // one weight per edge in the path float *a; //activations float *error; // errors for back-propagation intLayerOffset[Layers]; // base index for layers in activa LayerOffset [0]= NeuronsPerLayer [0]; for (int 1 = 1; 1 < Layers; ++l) {  for (int i =0; i < Paths; ++i)   Weight [l] [i] = InitialWeight;  LayerOffset [l] =LayerOffset [l − 1] + NeuronsPerLayer[l]; } a = new float [LayerOffset[Layers − 1]]; error = new float [LayerOffset [Layers − 1]]; int Offset= 0; for (int l = 0; l < Layers; ++l) {  for (int i = 0; i < Paths; ++i)#ifdef LOW_DISCREPANCY  Path[l] [i] = Offset + (int) (P[i] [l] *NeuronsPerLayer #else  Path[l] [i] = Offset + (int) (drand48() *NeuronsPerLaye #endif  Offset += NeuronsPerLayer[l]; }

Table 3 illustrates an exemplary linear complexity C++ implementation ofthe inference (feed-forward) step of an artificial neural networkdefined by paths using the ReLU activation function, according to oneembodiment. The implementation shows the explicit execution of the ReLUactivation function. Omitting that loop and uncommenting theif-statement implicitly realizes the ReLU activation function in a morehardware-amenable form, as the sign bit of the activation is sufficientto mask the accumulation operations.

TABLE 3 inline void fastFeedForward(float *input) {  for (int i = 0; i <LayerOffset[0]; ++i)   a[i] = input[i];  // alternatively copy bias [i]values to a[i]  for (int i = LayerOff set [0]; i < LayerOff set [Layers− 1]; ++   a[i] = 0.0f ;  for (int l = 1; l < Layers; ++l)  {   for (inti = 0; i < Paths; ++i)   //if (a [Path [l − 1] [i]] > 0.0f ) // implicitReLU    a [Path [l] [i]] += Weight [l] [i] * a [Path [l − 1] [i]];   //explicit ReLU   for (int i = LayerOffset [l − 1]; i < LayerOffset[l];++i)    a[i] = (a[i] > 0.0f ? a[i] : 0.0f) ;  } }

It still may happen that some neural units are never touched or thatsome connections are sampled multiple times. While this cannot beavoided using randomized methods to trace the paths, there existnumber-theoretic constructions that allow one to create connectionpatterns with guarantees on coverage, fan-in, and fan-out.

In that spirit, a hardware architecture for sparse artificial neuralnetworks may be introduced. One stage of the pipeline architecturecorresponds to one layer of an artificial neural network and takes careof feed-forward, back-propagation, and weight update in that layer. Anartificial neural network is specified by the number of neural units perlayer and both fan-in and fan-out for all neural units of a layer. Theconnections between layers are established using deterministicpermutations, which allows one to avoid duplicate connections and toguarantee coverage of all neural units. The architecture has not beendesigned for convolutional neural networks. For sufficiently smallfan-in and fan-out, the resulting artificial neural networks exposestructural sparsity. Larger sparse neural networks may outperformsmaller but dense networks of about the same complexity.

Similarly, artificial neural networks based on expander graphs wouldguarantee at least one possible path from each input to each output.With respect to computing n output feature layers from m input featurelayers, a subset of D<m input feature layers may be selected for each ofthe n convolutions to reduce the complexity of convolutional layers. Theimplementation, however, is based on a random sampling method that doesnot guarantee the connection property.

In one embodiment, fan-in and fan-out depend on the number of paths andthe number n_(l) of neural units per layer. If the number of neuralunits and the number of connections between layers are powers of two,the Sobol' sequence guarantees that the fan-in and fan-out per neuralunit is an integer and constant per layer. Instead of selecting the samenumber of paths between layers, any power of two number of edges betweenlayers generated using the Sobol' sequence guarantees the same. Inaddition, fan-in and fan-out may be adapted by trajectory splitting.See, for example, “Quasi-Monte Carlo image synthesis in a nutshell” byAlexander Keller, which is herein incorporated by reference in itsentirety.

Using a deterministic low discrepancy sequence, P[l][i] may beunderstood as a function evaluation of the l-th component of the i-thvector of such a sequence, in other words, an address generator that formany low discrepancy sequences efficiently may be implemented inhardware. Especially for sequences like the Sobol' sequence, contiguousblocks of addresses generated by one component are permutations andhence guarantee for collision free routing when connecting layers inparallel.

Progressive Sparse Training

Instead of generating subsets of an artificial neural network by dropoutor partitioning, a subgraph may be generated as the union of the neuralunits touched by a contiguous block of paths (see, for example, FIG. 9)from a sequence of paths. This procedure then is iterated for each batchof the training. Other than dropout, dropconnect, or partitioning, thesubgraphs are guaranteed to be connected. This way, training complexityis guaranteed to be linear per iteration.

Besides random walks on the graph of the network, low discrepancysequences may be applied to sample the paths through the network in aprogressive manner. This construction is based on so-called (t,s)-sequences in base b, which in fact are sequences of (t, m, s)-nets inbase b.

For example, the deterministic Sobol' low discrepancy sequence is a (t,s)-sequence in base b=2 that creates s dimensional points in the unithypercube [0, 1)^(s) that are uniformly distributed. These points may bevery efficiently computed. A hardware realization is simple, because thearithmetic is entirely based on finite fields with a power of 2elements. Now the components of the Sobol' sequence have the propertythat each contiguous block of a power of 2 elements forms a permutation,which guarantees that layers in a neural network linked by aquasi-random walk using the Sobol's sequence are linked by sets ofpermutations.

Using the low discrepancy branch in the algorithm in Table 2, generatingthe deterministic quasi-random walks is as simple as evaluating theP[l][i] in Table 2 using the s-dimensional points instead of apseudo-random number generator. Given the layer land the index i of thepath, the corresponding component of the Sobol' sequence and itsscrambled variants may be computed by a simple specific circuit ofBoolean logic, which allows for using the sequence without explicitlystoring its points.

As these permutations are progressive, contiguous blocks of quasi-randomwalks generated by the Sobol' sequence may be used to subsample neuralnetworks instead of using dropout.

Note that low discrepancy sequences may be randomized and/or scrambled,which may preserve their permutation properties. Note that this is notnecessarily guaranteed when using pseudo-random number generatorsinstead of low discrepancy sequences.

Similar to computer graphics, tracing paths through networks may be doneby starting at the inputs, tracing back from the outputs, or starting atboth ends and connecting path segments.

Training Sparse from Scratch

Instead of progressively subsampling a neural network, one set of pathsmay be used to fix a sparse architecture, see for example FIG. 9.Training sparse from scratch, the complexity of both inference andtraining is linear in the number of neural units touched by the paths.

Uniform Initialization

Before training, the weights of an artificial neural network need to beinitialized.

Usually, Gaussian distributed random variables or small scale uniformrandom variables are used, which results in unpredictable output duringthe initial training phase. This may be avoided by training a neuralnetwork to approximate uniform distribution before learning from data.

For recurrent artificial neural networks, starting with a uniformlyscaled diagonal unit matrix for the hidden-to-hidden weights may work.

However, initializing the weight matrices with a small positive constantworks nicely when we subsample the artificial neural network as shownabove. While this may seem counterintuitive at first sight, observe thatonly a subset of the connections is selected. Hence the weights of theselected connections are initialized to a constant, for example, theinverse of the number of connections of a neural unit in order to benormalized, while the non-selected connection weights implicitly are setto zero. Thus the corresponding weight vector in a fully connected layerwould consist of randomly or quasi-randomly chosen indices with zero andnon-zero values. This configuration is sufficiently uniformlydistributed to allow for convergence during training.

Sparse by Quantization after Training

Given a trained artificial neural network, it is simple to compress thisnetwork to use weights in {−1, 0, 1} by just sampling proportional tothe weights of each neural unit as explained above. Starting from theoutputs, paths are sampled backwards proportional to the weights of eachneural unit visited along the path. This corresponds to importancesampling paths in a weighted graph.

The resulting network then only uses addition and subtraction and nomore multiplication by weights. Note that connections may be sampledmore than once and hence may be replaced by one connection with theweights summed up.

In fact, a derivation of ternary weights is provided, and at the sametime explains, why binary weights of only {−1, 1} or {0, 1} did notnecessarily work: They could not be derived as discrete densityapproximation. One exemplary scheme may be considered a compiler thattranslates a trained artificial neural network into a ternary one. Withrespect to duplicate connections there is an interesting observation: Inour scheme, connections may be sampled more than once if they aresufficiently important given the number of samples. Such duplicateconnections cannot appear during weight quantization when not allowingfor multiple references, however, they may appear as duplicate filterkernels.

Sparse Inference

While subsampling weights improves efficiency for large filters, it maynot help much if the number of weights is small. Instead, theactivations of an entire feature layer may be subsampled online duringinference (and training) as illustrated in FIG. 10. More specifically,in sparse inference, neural units are selected proportional to theiractivations. This principle applies to any kind of layer, for examplefully connected layers 1002 or convolutional layers 1004. This way,computations may be reduced dramatically, as only a fraction or aconstant number of the connections are selected during feed-forward.

This may be applied to any kind of layer in general, is especiallyuseful for convolutional layers, and may help when the staticquantization is not sufficiently efficient.

In our implementation, we sample proportional to the activations of alayer online during inference and count how often an activation (i.e.neural unit) is selected. These counters then are divided by ∥a∥₁ andthe result is fed forward. As compared to Equation 1, we now sampleproportional to the distribution of the activations a_(k), which for theReLU case are non-negative.

If the activations are quantized to {0, 1}, we will only sum up weightswithout any multiplication. The subsampling may be considered anotherkind of regularization. In the limit, fixing the input and repeatedlysubsampling activations as described resembles a network, where neuralunits spike proportional to their activations.

In a similar way, errors may be propagated back through the network bysampling proportional to the error of a layer.

The techniques introduced herein above may be applied to recurrentconnections.

While not only applicable to the quantization of recurrent weights, wemay have sparse recurrent connections from scratch and sparseactivations.

Besides sampling proportional to the activations of a layer, we also maysample proportional to the product of activations and weights duringinference. This corresponds most to what in Monte Carlo methods iscalled importance sampling. The neural unit under consideration thenjust adds up the −1 for sampled connections with negative weights and +1for sampled connections with positive weights. The efficiency of such anapproach depends on the number of entries in the discrete probabilitydensity. Obviously, it only pays off if the number is not quadratic.

CONCLUSION

We showed that dropout partitions realize dropout at only a fraction ofthe pseudo-random numbers used before. Sampling proportional to theweights of a neural unit provides a derivation of ternary weights andyields a simple algorithm to create artificial neural networks that onlyuse addition and subtraction instead of weight multiplication. As aconsequence, it is straightforward to quantize neural networks tointeger weights without retraining. Replacing drop connect and dropoutby random- and quasi-random walks to generate paths through artificialneural networks guarantees no dangling neural units and linearcomplexity in space and time for both inference and training. Generatingthe paths before training results in artificial neural networks sparsefrom scratch. Constructing sparse artificial neural networks with linearcomplexity bears the potential of artificial neural networks withoutmax-pooling, i.e. without resolution reduction, and therefore moreprecision.

FIG. 11 illustrates a flowchart of a method 1100 for generating paths toconnect a set of neural units within an artificial neural network, inaccordance with an embodiment. Although method 1100 is described in thecontext of a processing unit, the method 1100 may also be performed by aprogram, custom circuitry, or by a combination of custom circuitry and aprogram. For example, the method 1100 may be executed by a GPU (graphicsprocessing unit), CPU (central processing unit), an FPGA (fieldprogrammable gate array), or any processor or reconfigurable processorcapable of performing the evaluation and/or training of ANNs.Furthermore, persons of ordinary skill in the art will understand thatany system that performs method 1100 is within the scope and spirit ofembodiments of the present invention.

As shown in operation 1102, a number L∈

of layers is selected for an artificial neural network.

Additionally, as shown in operation 1104, for each layer l∈{0, . . . ,L−1}, a number n_(i)∈

of neural units a_(l,j) are selected, where 0≤j<n_(l).

Further, as shown in operation 1106, a number of paths n and anL-dimensional sequence x_(i)=(x_(i,0), . . . x_(i,L−1)) uniformlydistributed on [0, 1)^(L) are selected.

Further still, as shown in operation 1108, for each i∈{0, . . . , n−1}neural units a_(l,└x) _(i,l) _(·n) _(l) _(┘) and a_(l,└x) _(i,l+1) _(·n)_(l+1) _(┘) are connected to create the paths to connect the set ofneural units within the artificial neural network.

In this way, the paths generated to connect the set of neural unitswithin the artificial neural network are random walks within theartificial neural network generated by a deterministic low discrepancysequence.

FIG. 12 illustrates a flowchart of a method 1200 for compressing anartificial neural network, in accordance with an embodiment. Althoughmethod 1200 is described in the context of a processing unit, the method1200 may also be performed by a program, custom circuitry, or by acombination of custom circuitry and a program. For example, the method1200 may be executed by a GPU (graphics processing unit), CPU (centralprocessing unit), an FPGA (field programmable gate array), or anyprocessor or reconfigurable processor capable of performing theevaluation and/or training of ANNs. Furthermore, persons of ordinaryskill in the art will understand that any system that performs method1200 is within the scope and spirit of embodiments of the presentinvention.

As shown in operation 1202, an artificial neural network (ANN) iscompressed by subsampling a plurality of edges each representing aweighted connection within the ANN. In one embodiment, the ANN mayinclude layers that are fully connected. In another embodiment, the ANNmay include layers that are convolutional. In yet another embodiment,each of the plurality of edges may be subsampled by performing one ormore of random sampling, pseudo-random sampling, and quasi-randomsampling.

For example, an ANN may include a plurality of layers, where each layerincludes a grouping of neural units. If the ANN is fully connected, eachneural unit within a layer is connected (via an edge) to all neuralunits of a preceding layer as well as all neural units of a subsequentlayer within the ANN. These connections are called edges. In this way,all neural units of a fully connected ANN are either directly orindirectly connected to each other.

Additionally, the ANN may be compressed by sampling (e.g. selecting,etc.) a subset of all connections (edges) between the layers of neuralunits. In one embodiment, the edges may be sampled randomly. In anotherembodiment, the edges may be sampled in a pseudo-random manner. In yetanother embodiment, the edges may be sampled in a quasi-random manner.Results of the sampling may include a compressed ANN that includes oneor more of the sampled edges, the neural units associated with thesampled edges, and one or more paths created utilizing the one or moresampled edges.

FIG. 13 illustrates a flowchart of a method 1300 for performing networknormalization, in accordance with an embodiment. Although method 1300 isdescribed in the context of a processing unit, the method 1300 may alsobe performed by a program, custom circuitry, or by a combination ofcustom circuitry and a program. For example, the method 1300 may beexecuted by a GPU (graphics processing unit), CPU (central processingunit), an FPGA (field programmable gate array), or any processor orreconfigurable processor capable of performing the evaluation and/ortraining of ANNs. Furthermore, persons of ordinary skill in the art willunderstand that any system that performs method 1300 is within the scopeand spirit of embodiments of the present invention.

As shown in operation 1302, network normalization is performed bynormalizing a plurality of weights of a first layer of an artificialneural network (ANN) with a linear factor. Additionally, as shown inoperation 1304, the normalized plurality of weights is propagated tosuccessive layers of the ANN by multiplying weights of the successivelayers by the linear factor. Further, a last layer of the ANN storesresulting weights to scale outputs of the ANN. In one embodiment, theANN includes one or more of a ReLU activation function, a leaky ReLUactivation function, a maxpool activation function, and an absolutevalue activation function.

While various embodiments have been described above, it should beunderstood that they have been presented by way of example only, and notlimitation. Thus, the breadth and scope of a preferred embodiment shouldnot be limited by any of the above-described exemplary embodiments butshould be defined only in accordance with the following claims and theirequivalents.

The disclosure may be described in the general context of computer codeor machine-useable instructions, including computer-executableinstructions such as program modules, being executed by a computer orother machine, such as a personal data assistant or other handhelddevice. Generally, program modules including routines, programs,objects, components, data structures, etc., refer to code that performparticular tasks or implement particular abstract data types. Thedisclosure may be practiced in a variety of system configurations,including hand-held devices, consumer electronics, general-purposecomputers, more specialty computing devices, etc. The disclosure mayalso be practiced in distributed computing environments where tasks areperformed by remote-processing devices that are linked through acommunications network.

As used herein, a recitation of “and/or” with respect to two or moreelements should be interpreted to mean only one element, or acombination of elements. For example, “element A, element B, and/orelement C” may include only element A, only element B, only element C,element A and element B, element A and element C, element B and elementC, or elements A, B, and C. In addition, “at least one of element A orelement B” may include at least one of element A, at least one ofelement B, or at least one of element A and at least one of element B.Further, “at least one of element A and element B” may include at leastone of element A, at least one of element B, or at least one of elementA and at least one of element B.

The subject matter of the present disclosure is described withspecificity herein to meet statutory requirements. However, thedescription itself is not intended to limit the scope of thisdisclosure. Rather, the inventors have contemplated that the claimedsubject matter might also be embodied in other ways, to includedifferent steps or combinations of steps similar to the ones describedin this document, in conjunction with other present or futuretechnologies. Moreover, although the terms “step” and/or “block” may beused herein to connote different elements of methods employed, the termsshould not be interpreted as implying any particular order among orbetween various steps herein disclosed unless and except when the orderof individual steps is explicitly described.

What is claimed is:
 1. A method comprising: at one or more devices:creating, by the one or more devices, an artificial neural network (ANN)including a plurality of layers, the plurality of layers including atleast one ternary matrix.
 2. The method of claim 1, further comprisingtraining the ANN, where the at least one ternary matrix remains constantduring the training of the ANN.
 3. The method of claim 1, wherein eachof the at least one ternary matrix includes only the values −1, 0,and
 1. 4. The method of claim 1, wherein the at least one ternary matrixreplaces one or more fully connected layers within the ANN.
 5. Themethod of claim 1, wherein each of the at least one ternary matrix isused instead of a 1×1 convolution in at least one layer within the ANN.6. The method of claim 1, wherein each of the at least one ternarymatrix is used instead of a 1×1 convolution in at least one residuallayer of the ANN using at least one of a depth-wise separableconvolution.
 7. The method of claim 6, wherein the at least onedepth-wise separable convolution includes a time-channel separableconvolution.
 8. The method of claim 6, wherein at least one skip link ofthe at least one residual layer of the ANN is replaced by a unit matrix.9. The method of claim 1, wherein during a performance of inferenceutilizing the ANN, multiplication actions performed utilizing each ofthe at least one ternary matrix are executed as a difference of twosums, where a first sum is a sum of all inputs to be weighted by thevalue 1 and a second sum is the sum of all inputs to be weighted by thevalue −1.
 10. The method of claim 1, wherein all elements of the atleast one ternary matrix are generated on-chip.
 11. The method of claim1, wherein each of the at least one ternary matrix includes pathsgenerated utilizing a low discrepancy sequence.
 12. The method of claim1, wherein each of the at least one ternary matrix is generated using apseudo-random number generator.
 13. The method of claim 1, furthercomprising, for each of the at least one ternary matrix: storing aninitial state of a hardware-based pseudo-random number generator thatwas used to generate weights for a quantization to compute the ternarymatrix, and using the stored state to regenerate the ternary matrix. 14.The method of claim 1, wherein the plurality of layers also include oneor more identity matrices.
 15. The method of claim 14, wherein each ofthe one or more identity matrices within the ANN replace a fullyconnected layer within the ANN.
 16. A non-transitory computer-readablemedia storing computer instructions which when executed by one or moreprocessors of a device cause the one or more processors to cause thedevice to: create an artificial neural network (ANN) including aplurality of layers, the plurality of layers including at least oneternary matrix.
 17. The non-transitory computer-readable media of claim16, further comprising training the ANN, where the at least one ternarymatrix remains constant during the training.
 18. A hardware circuitimplementing an artificial neural network (ANN): wherein the hardwarecircuit includes a plurality of layers, the plurality of layersincluding at least one ternary matrix.
 19. The hardware circuit of claim18, wherein: during a performance of inference utilizing the ANN,multiplication actions performed utilizing each of the at least oneternary matrix are executed as a difference of two sums, the differenceis amplified by an operational amplifier, and each sum is computed bywiring a selected input on either a positive or negative input line ofthe operational amplifier.
 20. An artificial neural network (ANN)comprising: a plurality of neural network layers including at least onefirst fully connected layer; a ternary matrix; and a unit matrix;wherein the ternary matrix is representative of a second fully-connectedlayer or is representative of a 1×1 convolution layer; wherein the unitmatrix is representative of a skip link.
 21. A neural networkcomprising: a first fully-connected neural network layer; a ternarymatrix coupled to the first fully-connected neural network layer; and asecond fully-connected neural network layer coupled to at least one ofthe first fully-connected neural network layer and the ternary matrix.22. The neural network of claim 21, wherein output from the firstfully-connected neural network layer is provided as input to the ternarymatrix.
 23. The neural network of claim 21, wherein output from theternary matrix is provided as input to the second fully-connected neuralnetwork layer.